Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of rafael (2125)

Thursday January 16, 2003
05:36 AM

Scrapple from the Apple

[ #10011 ]
I'm often amazed at how vim's regular expressions just Do What I Mean.

Do I want to search for all lines that begin with a star ? The simpler regexp that just-works is /^*/. No need to quote the star with a backslash. Ditto for dollars that don't appear at the end of a pattern: they match the litteral character $, not the end of line.

That's the right thing to do in a text editor, but I don't think that's the right thing in a general-purpose programming language.

Title of this journal entry by Charlie Parker.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Interesting you should say that. It must be the way my brain works (or doesn't work) but I've always struggled with Vim's Regex requirments.

    Being reasonably competent in Perl 5 Regex syntax (thanks to Friedl's MRE) I just get annoyed at the differences I find in Vim and drop out and end up doing things in Perl.

    I suppose I should read the Vim docs but I'm almost afraid that my brain just can't hold two Regex flavours at once without stopping all together...

    • If you've read MRE, you know that there aren't two Regex Flavours. There are many more : I know at least the grep and the egrep/sed/awk ones.

      There used to be a project (before vim 6 was out IIRC) to bring Perl 5-compatible regexps to vim (i.e. to write a translator Perl 5-style to vim-style.) It was dropped, but you can still write a patch and attempt to convince Bram Moolenaar (who isn't a Perl-addict like us...)

      • There used to be a project (before vim 6 was out IIRC) to bring Perl 5-compatible regexps to vim (i.e. to write a translator Perl 5-style to vim-style.)
        In the mean time you can just use the likes of :perl and :perldo (see. :help perl for more info).
        --

        broquaint out