S
sb
I'm using the following regex expression where "searchword" is a string:
string regrexstr = @"( |^)\b" + searchword + @"+( |\b)"
My goal is to use this string to ultimately replace all occurances of
searchword as long as:
a) it has a preceeding space or it's the beginning of a line AND
b) it is suffixed with a space or a newline character
The problem right now is that using the above string and calling
Regex.Replace also replaces the leading/trailing spaces. I want the spaces
to count during the match, but be ignored during the replace. Is that
easily do-able?
I'm probably going about this the wrong way. In short, I want to do a word
replacement throughout a large file.
TIA!
-sb
string regrexstr = @"( |^)\b" + searchword + @"+( |\b)"
My goal is to use this string to ultimately replace all occurances of
searchword as long as:
a) it has a preceeding space or it's the beginning of a line AND
b) it is suffixed with a space or a newline character
The problem right now is that using the above string and calling
Regex.Replace also replaces the leading/trailing spaces. I want the spaces
to count during the match, but be ignored during the replace. Is that
easily do-able?
I'm probably going about this the wrong way. In short, I want to do a word
replacement throughout a large file.
TIA!
-sb