Visual Studio Find dialog non-standard regular expressions
What is the reason for Visual Studio's Find & Replace dialog regular expressions not following standard regex syntax, e.g. using :b
instead of \s
?开发者_运维问答
Maybe for the same reason that Perl, Emacs, extended Regexps all have different 'standard' syntaxes (albeit mostly similar): they were all developed with different requirements. Emacs doesn't seem to offer \d
for instance for matching numeric digits. (arguably \d
isn't 'standard', but is reasonably widely supported, so one might think that is was standard)
There's support for bidirectional and other unicode characters offers more control than what's available in POSIX, plus there's the rather useful :i
and :q
as shortcuts for C/C++ identifiers and quoted strings. So the different syntax presumably grew out of the domain-specific requirements of VS.Net. More on the different things supported here.
I agree that it is an annoyance to have a different syntax, but I also find it annoying to remember to type [:digit:]
rather than \d
when I'm emacs.
Hans is right, this is purely for backwards compatibility.
精彩评论