what can be the regular expression to select alphanumeric characters and only first occurance of $ in string “foo$blahblah$123$$”
Hi
Thanks for the sample.
- Can you tell more about the pattern within the text?
- What is your expected output?
Are you looking to get “foo$” or “$blahblah” or “blahblah$”?
Check out the below for a possible solution:
Left Assign:
Str_Result
Right Assign:
system.text.RegularExpressions.Regex.Match(str_Input, “INSERTxREGEXxPATTERN”).tostring
The above will only get the first result from a Regex expression.
Output pane example:
For the Regex patterns check the below links:
“Foo$” pattern - “[a-zA-Z0-9]+\$”
“$blahblah” pattern - “\$[a-zA-Z0-9]+(?=\$)”
“blahblah$” pattern - “(?<=\$)[a-zA-Z0-9]+\$”
Hopefully this helps you
Hi,
If result you expect is "foo$blahblah123"
, the following will help you.
System.Text.RegularExpressions.Regex.Match(yourString,"^.*?\$").Value+String.Join("",yourString.Split("$"c).Skip(1))
Regards,
Thank you for your time people, it works! Good Day!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.