Extract Regex Values

APatel

New Member
Hello,

Can someone please help me with regex?

I am trying to extract the following two items in the string below using Utility-Strings- Extract regex values in Blue Prism.
String= "Test=Check: 12345 for 10 Orders with 100:SN 1 Code: ABCDE"

1) Extract the values between the words for and Orders in the string above. Example: I need to extract the number 10 which is between for and Orders. This sometimes can be 1 digit or 2 digits
2) Extract the 2 characters right after the 2nd colon ":". Example I only need the letters "SN" extracted which is after the colon in 100:SN. This sometimes can be 2 letters or 2 digits

Thank you.
AP
 

JackT

New Member
Regex is not only about the pattern of the data you want, its also about the variation of strings from which you wanna extract the data.

just to mention that based on the requirement, I believe it can also be done by simple string manipulations.

the regex I create is as below:
Code:
(?<value1>\d{1,2}(?= Orders)).*(?<value2>(?<=\d:).{2})

test result - you can try it yourself from https://regex101.com/ as well.
1566355871708-png.4498


Cheers,
Jack
 

Attachments

  • 1566355871708.png
    117.2 KB · Views: 92
Top