996 Charla Lane, Richardson, TX, United States
51, avenue Jules Ferry, 02200 SOISSONS, France
42 Great Western Road, LOOSEGATE, United Kingdom
I want Only Country from above values. How to extract it. I think Split method wont work. Can we use Regex if yes please help.
Hi @Reddy_1 ,
You could try the split method (first split by new line, and afterwards split by comma) like this:
Demo file: SplitMethod.xaml (6.2 KB)
Hope this helps!
try using this regex [\w ]*$
Hi @prasath_S ,
Is this pattern working for countries like Guinea-Bissau or Timor-Leste?
This will work [\w -]*$ and also we can add all the special characters we need.
If you want to use Split method, the following expression will work.
arrResult = yourString.Split(vbcrlf.ToCharArray,StringSplitOptions.RemoveEmptyEntries).Select(Function(s) s.Split(","c).Last.Trim).ToArray
if use regex, the following also works. (It will match characters except comma at the end of line.)
mc = System.Text.RegularExpressions.Regex.Matches(yourString,"[^\s,][^,]+(?=\r?\n|$)")
Main.xaml (8.6 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.