inputVariable = Program : ZABC_PQ_STP_DM ( ZABC_PQ_STP_DM )
required output:
outputVariable = ZABC_PQ_STP_DM
inputVariable = Program : ZABC_PQ_STP_DM ( ZABC_PQ_STP_DM )
required output:
outputVariable = ZABC_PQ_STP_DM
Hi @anjasing
Take a look at these options:
Option 1
Option 2
Option 3
If you want to learn Regex Check out my Regex MegaPost
Can you expand upon the pattern of text. What is consistent?
Cheers
Steve
EDIT: I had the wrong sample Input
Alright, logging off for today
Hi @anjasing
Try this regex expression
System.Text.RegularExpressions.Regex.Match("InputStr","(?<=Program\s:\s)(\S+)").Tostring.Trim
Regards
Gokul
Hi @anjasing ,
It depends - are you interested in retrieving the text present within the Brackets or the text preceding the brackets?
I’ve included the solution to both →
System.Text.RegularExpressions.Regex.Match(inputVariable,"(?<=\:\s)(.*?)(?=\s?\()").Value
System.Text.RegularExpressions.Regex.Match(inputVariable,"(?<=\(\s)(.*?)(?=\s?\))").Value
Do let us know if that works.
Kind Regards,
Ashwin A.K
Hi All, Thank you so much for your quick replies.
Thank you so much for the links…that are great!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.