Regular Expression Problem

Hi, please i need helo, i read 3 differences pdf similar data. I have to make a regular expression, i have to remove blank space and special characters. My regular expression is

(?<=DEMANDADO)(.*\S)

and the string is

DEMANDADO :FRANCISCO JAVIER SEGURA GODOY

at the end the string have to be FRANCISCO JAVIER SEGURA GODOY.

Please Help Me

Hy @Hector_Silva,

to Remove Special Caracters use the following function:
System.Text.RegularExpressions.Regex.Replace(MyText, “[^a-z A-Z]”, “”)

To Remove empty spaces from the beggining and end of your strings use the Trim function:
MyText.Trim

Please let me know if you have any more questions.

Regards

1 Like

Thanks. It work. But i have a question I have thsi result:

ORTEGA PEREZ JUAN FERNANDO RUT

and i like to remove the word RUT, can you help me please

1 Like

Hy Hector, I am glad I could help you!

You could do the following:
MyString = “ORTEGA PEREZ JUAN FERNANDO RUT”
MyStringADJ = MyString.Remove(MyString.LastIndexOf(" "))

the result will be
MyStringADJ = “ORTEGA PEREZ JUAN FERNANDO”

Please like my post and mark my answer as solution!

Thanks

1 Like

Thanks my friend, im relaly new in this and i like to khow more. One last question if the word if i want to remove is in the middle o in another position of the string the solution should be??

Hy @Hector_Silva,

You could remove a specific word like this:
Strings.Repalce(MyWord, MyWordToRemove,“”)

Happy automation!!!

1 Like

Thank you so much!!!

1 Like

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