Re: Regular Expression: Perl and vi
- From: "John W. Krahn" <dummy@xxxxxxxxxxx>
- Date: Mon, 13 Aug 2007 19:35:55 GMT
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
.
- Follow-Ups:
- Re: Regular Expression: Perl and vi
- From: Brian Blackmore
- Re: Regular Expression: Perl and vi
- References:
- Regular Expression: Perl and vi
- From: googler
- Regular Expression: Perl and vi
- Prev by Date: Re: Pagination II
- Next by Date: Re: Optimized count of files in tree
- Previous by thread: Regular Expression: Perl and vi
- Next by thread: Re: Regular Expression: Perl and vi
- Index(es):
Relevant Pages
|