Re: Rexex replace
- From: "tshad" <toms@xxxxxxxx>
- Date: Mon, 21 Dec 2009 14:24:18 -0800
"Peter Duniho" <no.peted.spam@xxxxxxxxxxxxxxxxxx> wrote in message
news:ecMc6rCgKHA.5560@xxxxxxxxxxxxxxxxxxxxxxx
tshad wrote:As Jeff mentioned, there is an apostrophe there that I didn't see and it
I am curious why my Regex would not work when like this
tableName = Regex.Replace(tableName, "'$", "")
But worked fine like this:
tableName = tableName.Replace("$", "");
Because the two are not the same? I don't know what you intend the "'$"
to do, but as far as I know it won't be anything useful in Regex. I don't
think it's the same as "find all instances of the '$' character".
should delete all "$", unless you need the "\" in front of it. Not sure
about that.
I think probably you want "\$" as your expression, but of course there
remains the question of why use Regex when the String.Replace() method
already does exactly what you want. The String method will be much more
efficient too.
It was there because it was actually part of a couple of other Regex
statements. I pulled it out to test it.
I did end up using the String.Replace but probably the Regex would also work
if it didn't have the apostrophe.
Thanks,
Tom
Pete
.
- References:
- Rexex replace
- From: tshad
- Re: Rexex replace
- From: Peter Duniho
- Rexex replace
- Prev by Date: Re: Automate another app from my C# app
- Next by Date: Re: How to: class library write back to form
- Previous by thread: Re: Rexex replace
- Next by thread: Re: Rexex replace
- Index(es):
Relevant Pages
|