*Real* regex search-and-replace in Visual Studio
niugang just posted some very cool code on CodeProject: a Visual Studio add-in that gives you real regex search and replace.
It’s long annoyed me that Visual Studio’s regex support is so weird. They have a lot of the features, but their syntax is truly, truly warped. ({} for captures? @ and # and ^ for quantifiers? Needing to either roll a manual character class, or else understand the full Unicode spec, just to do something simple like \w?) And they’re missing some of the most interesting and useful features, like lookbehind and positive lookahead. Which is silly, because they have full-fledged Perl-compatible regular expressions sitting right there in the Framework.
Okay. Enough ranting. This add-in should be way cool. Unfortunately, niugang had to create all new UI, since there was no way to reuse the standard Visual Studio search and replace dialogs. This probably means some of the fancier features are missing (I suspect that I won’t be able to select two different directories and tell it to search them both, for example). But even so, I’m very much looking forward to real regexes in VS. And hey, it’s got source code.
Now someone just needs to write a real regex search-and-replace for Delphi…
January 12th, 2005 at 9:04 pm
A few things I found for Delphi are
http://www.pcre.org/
and .Net (Nick Hodges is going to love me for pumping .Net) has a full regular expression library built in, which is easy to call from D8/D2005
January 12th, 2005 at 10:23 pm
Yeah, I already said .NET has a full PCRE regex library. What I’m wondering is when the Delphi IDE’s Find and Find In Files and Replace will be upgraded to actually *use* those real regexes.
(Y’know, I should write this up as an enhancement in QC…)