Chris,
As Brian suggested:
VB.NET just does not support C# escape sequences, nor does VB.NET define its
own escape sequences!
The "\n" is only supported in regular expressions and replacement patterns,
not the replace string according to the Character Escapes section of Regular
Expression Language Elements:
http://msdn.microsoft.com/library/d...l/cpconRegularExpressionsLanguageElements.asp
This is not a VB.NET problem per se, C# & every other .NET language will
have the same problem, as the RegEx class itself is defining this behavior.
(Read as I hope your rant is against the RegEx class and not VB.NET! ;-))
Unfortunately I do not know of a predefined routine that will replace the C#
escape sequences with their respective characters. If you build one, I would
recommend using a StringBuilder in the implementation.
Hope this helps
Jay
Chris Anderson said:
I guess I should have pointed that out in the original posting...
I could certainly do it like that or by a few other means in the code. But
the problem is that I'm loading replace expressions dynamically from a text
file and I need the ability (specifically) to allow Unicode characters such
as \u200e in the replace expression, and also the whole range of general
character escapes. I can't hard code those. I could come up with a little
parser to replace character escapes from the script before sending them to
the regex replace, but that's a pain. There's no reason that VB shouldn't
support this. The regex engine is part of the .net framework and should
conform to common functionality, as far as I'm concerned. Anyway, regardless
of the fact that VB doesn't generally support escape characters doesn't mean
that they shouldn't work in regex. Afterall, $1 means nothing special in VB,
but does in a regex replace string.
Now I'm just ranting... Point being, I need to do this the way it should
work. I'm hoping there's either some sort of update available or some crazy
secrect syntax such as $#\\u002e to do what I need.