Remove blank space between non numeric character in string

Hello,

I want to replace the blank spaces in my string (" ") if the characters between the space arent numbers.

For example: If the input string is “10/20/2020 Name and City 1234 4321” the output string should be like: “10/20/2020 Name_and_City 1234 4321”.

PS: The non-number part of the string is not always the same.

Can anyone help?

Hi,

Hope the following expression helps you.

System.Text.RegularExpressions.Regex.Replace(strData,"(?<=[A-Za-z]) (?=[A-Za-z])","_")

or

System.Text.RegularExpressions.Regex.Replace(strData,"(?<=\D) (?=\D)","_")

Regards,

Awesome!

Thank you very much.

RegexReplace.xaml (13.7 KB)

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