Regex code to get the ISIN number

Hello community!

In this above image as you can see there is text format like this 9830076257Y YO
So i want that in front of 9830076257Y YY

That YO or YN should replaced with YY this whole data is in notepad.

What logic i can apply?

@Priyesh_Shetty

Read the image data using Read text with ocr then save it in a string

YourString.Replace(“YO”,“YY”).Replace(“YN”,“YY”)

image

Can you check:

We would work with Regex.Replace(strTestVar, strPatternVar, strReplaceString)

[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

@rlgandu but sometime this code is replacing the name YO or YN in notepad.

Hey @Priyesh_Shetty
if you are looking regex expression you can try this:
System.Text.RegularExpressions.Regex.Replace(inputText, "98[0-9]{8}Y Y[ON]", "98$1YY")

Hi @Priyesh_Shetty

  1. Read Notepad Text with Read Text Activity and assign in Variable str_Text in String.
  2. Use Assign Activity to replace the text according to your requirement.

str_Text.Replace("YO","YY").Replace("YN","YY")

Hope it will helps you :slight_smile:
Cheers!!

@Priyesh_Shetty

System.Text.RegularExpressions.Regex.Match(YourString,"\d{5,}[A-Z]+\s[A-Z]+").ToString.Replace("YO","YY").Replace("YN","YY")

@rlgandu this is giving wrong name actually

@Priyesh_Shetty

Please put the notepad file so it will be easy to replace "YO"and “YN” to “YY”
If it contains senstive information then give me a sample data

Data is like this in notepad.

@Priyesh_Shetty

I want notepad data

@rlgandu due to security purpose cant share the file.

Hi @Priyesh_Shetty

According to your input I find @GMAIL.COM as static may be you could use the below syntax:

System.Text.RegularExpressions.Regex.Match(Input,"(?<=\@GMAIL.COM\s*).*").Value.Trim().ToString.Replace("YO","YY").Replace("YN","YY")

Hope it helps!!

@Priyesh_Shetty
Can you text me personally

Hello! To achieve this in Notepad, you can use the “Find and Replace” feature. Open your Notepad document, press “Ctrl + H” to bring up the Find and Replace dialog. In the “Find what” field, enter “9830076257Y YO” (without quotes), and in the “Replace with” field, enter “9830076257Y YY”. Then, click on “Replace All”. This will replace all occurrences of “9830076257Y YO” with “9830076257Y YY” in your document. If there are variations like “9830076257Y YN,” you can repeat the process by searching for “9830076257Y YN” and replacing it with “9830076257Y YY.” Make sure to save your document after making the changes.
Regards