G
googler
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.
Thanks.
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.
Thanks.