I am trying to use regex to replace some of the words from string.
Example string “MR Jerry Jone”
MR could be (mrs,ms) as well, I want to include “,” those to replace it with the empty string.
case insensitive regex will do.
IF you can point me the pattern and explanation . that would be great. thanks
@whitestar Are there any there any other Input Formats you have, or all the Other Input Formats are in the Same way?Like Starting will always be “MR/mr” or “Ms/ms” ?
i did’nt get that replace it with “,” can you show us sample?
Starting will not always be “Mr/mr” or “mrs/Mrs” or “ms/ms” it could be the address as well but mostly it will come with “Mr/mr” or “mrs/Mrs” or “ms/ms” i only want to to replace those with empty string
sorry i will give you an example
String = “UiPath,RPA,Enterprise,Ms”
i want to replace those with empty string. I can do with .replace 1 by 1 but i want to know how to do in 1 regex syntax.
@whitestar Can you Show us the Ouput you Expect for that Example String?
String = “Mr,Peter,Parker”
string = Peter Parker
@whitestar Ok, But will be there any Keyword or Constant term always after the name? (In this case after Parker)
sometime it could be the home address. if that’s the case. i don’t want to replace any.
@whitestar u can use regular expression like:
TempVar = System.Text.RegularExpressions.Regex.Replace(Temp,“Mrs|mrs|ms|miss|MR”,“”).ToString
Temp = “MR Jerry Jone” (Your String)
This will replace your “Mrs|mrs|ms|miss|MR” empty string…
Sequence.xaml (5.2 KB)
you can go through this workflow i’ve created a sample
This expression will help you resolve this
Stroutput = System.Text.RegularExpressions.Regex.Replace(strinput.ToString.ToUpper,”(MR|MS|MRS|,)”,””).ToString.Trim
March 23, 2020, 8:39am
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.