tags:

views:

95

answers:

3

I am fluent with Microsoft Visual 2005 regular expressions and they are a big time saver.

I seem to learn them best by having a vaguely organized cheat sheet thrown at me, at which point I read just a little and play with them until I understand what's going on. That learning approach has worked well for me, for now.

I would really like to take this to the next level though. Basically --

  1. What is the REGEXP convention that is generally regarded as the most open-ended and powerful? VS2005 Regexps seem kind of gimped, so maybe I'm a kid playing in a sandbox.

  2. Are there text editors out there that can perform a highlight all matches, list lines containing string, or some kind of powerful function like that in conjunction with the very strongest REGEXP language? If not I can just use multiple programs and a weird technique but I'd like to avoid that.

I wonder if a stronger REGEXP language or a "stronger" regEXP writer might be able to have his search match all results on all lines even by clicking a "find next" by adding some simple criteria to the search.

Anyway, please provide advice!

+1  A: 

Most real languages have a similar regex implementations, and there really is none better than the other.

AFAIK there is no such thing as a "regex editor" -- that would be silly. Learn the implementation of whatever language you are using to perfection and don't rely on silly computers to know what you want.

Coronatus
Of course there is such a thing as a "regex editor". There are plenty of them, including my own RegexBuddy. But John isn't asking about regex editors. He wants a text editor that makes particularly good use of regular expressions. I'd recommend EditPad Pro but obviously I'm biased.
Jan Goyvaerts
+1  A: 

Regex Buddy

I've never used it myself, but I hear a lot of praise.

tylerl
+4  A: 

The best text editor as far as regex support is concerned, is EditPadPro, by Jan Goyvaerts, creator of RegexBuddy, PowerGREP and RegexMagic, author of regular-expressions.info and co-author of the Regular Expressions Cookbook.

It uses regular expressions for many things, including syntax highlighting, code folding, file type detection and more, and is therefore very powerful and highly customizable. The other editor I love, UltraEdit, has a decent regex engine, too, but it's no match to the JGSoft engine, and it's only half-heartedly implemented. No syntax highlighting by regex, for example.

The JGSoft engine is currently the regex engine that supports the most features regexes have to offer, see this comparison table. Notably absent is support for recursive pattern matching like .NET and PCRE provide, but Jan Goyvaerts said that this is planned for a later release.

Of course, RegexBuddy integrates seamlessly into EditPadPro, so you can get both - an editor with (among other things) perfect regex support, and an excellent regex editor.

And by the way, a mobile version of EPP for installation on a USB drive is included in the price of the desktop version (same thing with RegexBuddy et al.).

Tim Pietzcker
+1 for EPP! When I want to test an answer before I post it here, EditPadPro is usually all I need, no matter what the target language/flavor is. The one feature I miss is `\K`, currently supported only by Perl and the PCRE library (i.e., PHP). ...AFAIK. :D
Alan Moore
While EditPad does not yet support \K, it does support the full regex syntax inside lookbehind. The fact that Perl and PCRE impose quite a few restrictions on lookbehind is the main reason they added the \K token.
Jan Goyvaerts
Great reply! original poster here. I tend to copy text from UltraEdit into VS2005 mainly because I'm new to regExps and experimenting with this cheat sheet has been the most productive launching point due to my "mad scientist" initial learning approach: http://msdn.microsoft.com/en-us/library/2k3te2cs(VS.80).aspx.Trying EditPadPro but if it's pay-for software, my company probably won't let me use it. :(
John Sullivan
Yeah, looking at EditPadPro, and it looks incredibly useful, but since it's not software my company has officially approved, I must resort to freeware. "Penny wise, and a pound foolish" as the saying goes. I would really like to purchase and support your product Jan and make it my weapon of choice for text editing too but I should have mentioned that a lot of my options must be limited to freeware.I would like to buy and try it at home, anyway, though...
John Sullivan
@John, if your company skimps on the few bucks for a decent editor, you have my sympathy :). Buy it yourself, and get cracking.
Tim Pietzcker
@Jan: the main reason *I* want EditPad to support `\K` is so I can use it to test Perl/PHP regexes that use it. In fact, it seems like RegexBuddy (at least) should support it for that very reason.
Alan Moore
@Alan: RegexBuddy will support `\K` for the Perl and PHP flavors when we add support for the other new features in Perl 5.10. I haven't decided yet if we'll add `\K` to the JGsoft flavor too.
Jan Goyvaerts
@John: EditPad Pro's license agreement allows you to use EditPad Pro both at home and at work if you purchase a single user license. You can also create a portable installation to run it from a USB stick if you can't install software at work.
Jan Goyvaerts