>> the problem is the character class [ ] construct
yep thats it.
why are you escaping, the "%s"
It wasn't working, so i thought that "%" was a special regex character, like
a "." or a "?".
thanks for the quick read.
"stand__sure" <st*********@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com... (not that this matters -- it isn't the source of the error -- but) why
are you escaping the %?
the problem is the character class [ ] construct -- your regex is
matching either the character "%" or the character "s"
using the text of your original post and this expression
Public Dim oRegex as Regex = New Regex( _
"%s", _
RegexOptions.None _
)
the result is as follows:
I want to use the regex.replace for a string containing "others"
I can't seem to get the "others" escaped. I tried a normal "\others"
but that
doesn't seem to do it. Picks up any "s".
---------------------------------------------------------------------
Dim options As RegexOptions = RegexOptions.None
Dim oRegex As Regex = New Regex("[\others]", options)
dim s as string
s = oRegex.Replace("hellos to you and others", "others", 1) '----
note the 1
do replace only one time
I'd like s to be "hellos to you and others" but I get
"helloothers and others"
Ideas?