Hello I want to split the string

Hello,
I want the split string
Input:
main road, Bangalore, KT
main road, Hassan, KT

output:
Banglore, KT
Hassan, KT

Hi @copy_writes
use this regex

Regards,
Nived N
Happy Automation

main road is not same some times it will different
some times i get Bangalore, KT

i did not understand @copy_writes

main road, banglore, KT
banglore, KT
main street, Hassan, KT

now how to extract

(?<=\,).*(?=$)

image

Try the Above expression @copy_writes

1 Like

Can u try this way

1 Like

image
banglore is not select

we can use through split if its how

1 Like

If KT will change what we will do

can you please try using Split I don’t no how to use that for that am asking please help me .

Can u try this @copy_writes
String.Join(Split(input,Environment.NewLine).Select(Function(r) String.Join(β€œ,”,Split(r,β€œ,”).Where(Function(e) Not e.ToString,Contains(β€œmain”)))))

Just edited @copy_writes

1 Like

@copy_writes ,

Check with this split option

strInput.Substring(strInput.IndexOf(",") + 1)
2 Likes

Thank You very much it was simple

and thanks bro for try to give solution @NIVED_NAMBIAR @Pradeep_Shiv every time you both peoples are help me to come out from the solution

2 Likes

Always bro @copy_writes,

Happy learning

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.