Is there a good way to turn regex patterns into properly-escaped c# regex patterns?

  • Thread starter Thread starter sherifffruitfly
  • Start date Start date
S

sherifffruitfly

.... Becuase GOD am I getting sick of happily whipping out a rexex
pattern, and then spending 45 minutes squinting my eyes at the c#
code, trying to see if I have 4 backslashes, or only 3.


Suggestions greatly appreciated,

cdj
 
sherifffruitfly said:
... Becuase GOD am I getting sick of happily whipping out a rexex
pattern, and then spending 45 minutes squinting my eyes at the c#
code, trying to see if I have 4 backslashes, or only 3.


Suggestions greatly appreciated,

I suspect it wouldn't take very long at all to write a little
application (web or winforms) which let you type in either the C#
version and see what it really is, or the "real" version and see what
that should be in C#.

If you have many regular expressions in an application, you could keep
them in a resource file of some description, and refer to them by name.
That way you could do without any extra escaping.
 
Back
Top