Re: Regular Expression: Perl and vi



googler wrote:
I am trying to create a list of the differences in regular expression
for Perl and vi. I have been using both Perl and vi, and get confused
by this sometimes. There are a few that I already know of.

1. In Perl, characters like (, { etc when used as metacharacter can be
used by themselves (without using a \). In vi, they should be escaped
with a \. (Question: what is the full list of the metacharacters where
we see this difference?)

2. In Perl, non-greedy search can be done by using a ? character
(like .*?). In vi, this is done as .\{-}

3. In Perl, zero or one match can be achieved by putting a ? character
after the pattern. In vi, this is done by \=

4. In Perl, the RE for matching only a particular word is \bword\b .
In vi, it is \<word\> (Question: does \<word\> work for Perl?)

Please add to the list if you know of any difference that I missed.

Get the book:

http://www.oreilly.com/catalog/regex3/index.html

It should explain most if not all of the differences.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
.



Relevant Pages

  • Re: What is going on?
    ... Problem is i do not know Perl. ... $#ARGV is the array index of the last variable entered. ... $epc variable plus a '/' character. ... Save the return value of the $response->content subroutine. ...
    (comp.lang.perl.misc)
  • Re: Dynamically updating perl variables
    ... character of multi-character parameter values. ... The intention was that, once the data was in a Perl data structure, the calling ... the case of your given data subroutine would return a list that, ... nice to see what a full alternative solution would look like using your ideas. ...
    (perl.beginners)
  • Re: writing binary files
    ... > Python or Perl, since your post referred to Python:-D ... looks as though it would require a template character to be passed for every ...
    (comp.lang.perl.misc)
  • Re: Parsing a file that has labels
    ... Let me explain the above perl code. ... As such a character doesn't exist that means the whole ... replace every occurrence of the regexp, ...
    (comp.unix.shell)
  • Re: dbi and utf8
    ... and a text-field "tmp" containing a single character, ... The following perl script behaves as if DBI or the ADO driver ... I have inserted a schwar using Microsoft® Access. ...
    (perl.dbi.users)