Hello..
I am trying to extract a string after 2 different variation of keywords. However the digits to be extracted can vary.
Any help or suggestions to do this will be very helpful and very much appreciated.
Sample data :
Value |
PROG P523205 (22009442) OFFSET WAS UTILIZED BY |
PROGRAM P1483107(22009933) FEE OFFSET PARTIALLY |
PROGRAM P1341224 (22009904) OFFSET FULLY UTILIZED |
PROG P1735249 OFFSET FULLY UTILIZED |
Expected Results
Value | Program |
PROG P523205 (22009442) OFFSET WAS UTILIZED BY | P523205 |
PROGRAM P1483107(22009933) FEE OFFSET PARTIALLY | P1483107 |
PROGRAM P1341224 (22009904) OFFSET FULLY UTILIZED | P1341224 |
PROG P1735249 OFFSET FULLY UTILIZED | P1735249 |
Solved! Go to Solution.
Please try this formula with this regex configuration
regex formula : (?:PROG|PROGRAM)\s([A-Z0-9]+)
Thanks!!
Can I confirm my understanding of the formula?
(?:PROG|PROGRAM) <- this is the conditional pick-up identifier? if I have a 3rd condition, say "PROD" could I use PROG|PROGRAM|PROD?
\s([A-Z0-9]+)<-- A-Z means that any alphabet character + up to 9 numerical will be picked up? If the string was "Program P1341224 2209904 inv ref" would it also end up picking the digit "2" as the 9th numeric?
Hi @SArielle
One way of doing this even if you have PRG/PROGRAM/PROD etc.
(P\d+)
Many thanks
Shanker V
oh so basically the formula can picks up as long as it has that alphabet and numeric behind?
Hi @SArielle
Yes exactly.
However as I saw in your examples shared, the word was P, hence I have used the Regex to find P and all the digits following that.
Many thanks
Shanker V
If I used \d+ would it impact if let's say my program has a mixture of alphabets for example P124569A?
Hi @SArielle
Using \d+ will help to read only the digits.
If you program is mixture of alphabets and digits. Then use the below Regex.
(P\d+\u{0,1})
Many thanks
Shanker V
Hope this helps.
By using the regular expression pattern ([A-Z]\d+), you can extract the code that starts with any uppercase letter followed by one or more digits.
By using the regular expression pattern ([A-Z]\d+\u{0,1}) you can extract the code that starts with any uppercase letter followed by one or more digits followed by alphabet.
Thank you everyone. This is very helpful and very thankful for the supportive community here.