Have a doubt in string manipulation

My input is “don john boom”
But i want to get output like this
I want to remove last name

Ex : i need get “don john”

arr_var= string.split(" "c).torray

string _var= string.replace(arr_var(arrvar.count-1).tostring,“”)

try this syntax

Hey! Welcome to community…

Try this:

strOutput = System.Text.RegularExpressions.Regex.Match(strInputVariable,"[a-zA-Z]{1,}.[a-zA-Z]{1,}.*(?= )").ToString

Reference:

Before using this we have to import the namespaces from Imports panel like this

ImportsRegEx

Regards,
NaNi

1 Like

Thank q soo much @THIRU_NANI

beginners can’t understand regex they have to go from beginning

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