I have a string input of “last name, first name” and i would like the string output of just the last name by using regex. Any help developing the regex help would be great
Hi,
You can get it using the following sentence.
System.Text.RegularExpressions.Regex.Match(strData, "^.*(?=,)").ToString
Regards,
1 Like
I was testing it on the online regex tester and it doesn’t seem to work? if i am using the matches activity would the pattern just be “^.*(?=,)”
You can split it based on the comma. It’s simplest one.
str = “last name, first name”
requiredStr = str.Split(","c)(0)
Hi,
Which online tester site do you use?
You can easily check using Write Line Activity if it works good.
System.Text.RegularExpressions.Regex.Match("last name, first name", "^.*(?=,)").ToString
You’ll get last name
Regards,
It works!