I have the following text:
txtAddressSup.Text
I want the Sup
to be replaced by Cus
while the whole text remains as is. I have many texts that are in this format:
xxxxxxxSup.xxxxx
I have the following text:
txtAddressSup.Text
I want the Sup
to be replaced by Cus
while the whole text remains as is. I have many texts that are in this format:
xxxxxxxSup.xxxxx
why do you need to use regex? Won't a simple string replace work?
myString = myString.Replace("Sup.","Cus.");
The regex to match those would be (common Regex syntax, not the one from Visual Studio):
\BSup(?=\.\w+)
Just replace the matches with Cus
It's not clear from your question but I guess you are doing this in Visual Studio. Visual Studio uses a strange brand of regular expressions that is incompatible with most other engines. Try this:
Find: {:i}Sup{\.:i} Replace: \1Cus\2
Explanation:
{...} Tag expression (usually called a capturing group in other engines) :i Identifier Sup Literal string "Sup" \. Literal string "."
To get help with this either see the description of the syntax for Visual Studio regular expressions on MSDN or press the black triangle next to the input fields to get quick help.