Re: Rexex replace

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



tshad wrote:
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".

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.

Pete
.



Relevant Pages

  • Re: Rexex replace
    ... I don't know what you intend the "'$" ... but as far as I know it won't be anything useful in Regex. ... there is an apostrophe there that I didn't see and it ... The String method will be much more ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Keep only one part of a string
    ... Eero Saynatkari nous a dit: ... I'm pretty sure there is a String method that would keep only the first ... match of the regex but I didn't found it in the String doc reference ...
    (comp.lang.ruby)
  • Re: Keep only one part of a string
    ... Zouplaz wrote: ... I'm pretty sure there is a String method that would keep only the first ... match of the regex but I didn't found it in the String doc reference ...
    (comp.lang.ruby)
  • Keep only one part of a string
    ... I'm pretty sure there is a String method that would keep only the first match of the regex but I didn't found it in the String doc reference ...
    (comp.lang.ruby)
  • Re: Hub transport regex is broken, a horrible implementation, or Im an idiot.
    ... grep, egrep, and perl - all of which use a standard regex ... occurrences of the preceding character. ... I don't know which regex engine they use, ... organization' predicate, I can already tell you it won't work thanks ...
    (microsoft.public.exchange.admin)