ME <(E-Mail Removed)> wrote:
> I am trying to find a prewritten method for converting a string like
> this:"Hello World" to this "Hello\sWorld". I plan to use it to build a
> regular expression. Specifically I am looking for a method that can convert
> not just space (\s) but also any character that needs to be escaped in a
> given string.
Well, Regex.Escape will convert "Hello World" to "Hello\ World". This
is more exact than "Hello\sWorld" which would match *any* whitespace,
not just space. Is that okay for your purposes?
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too