Ben Schmidt wrote:
[Resending to the list. Originally from BPJ.]

2011-05-04 01:03, Ben Schmidt skrev:
perl returns '1a11c1', BTW!

Mmm. It's a bit debatable whether the second 1 in the 11
represents an
overlapping match or not. That's the problem with zero-length matches
that aren't solidly anchored; there are a lot of funny edge cases.

Apparently there's one match for "b" and one match for
the nothing between b  and c.  Rather what you would
expect from a pattern which essentially means "match
any number of b's or nothing": every b and every
non-character position in the string abc has indeed become
1.

2011-05-04 07:11, Ben Schmidt skrev:
Vim's regular expressions are far from standard. Just
browse pattern.txt and you will see many oddities
documented or demonstrated, as well as many
extensions to facilitate things such as syntax
highlighting. I'm pretty sure most other Vi and Vi
clone programs have their own oddities, too.

I'm not sure whether Sed or Perl is more 'correct'. I
haven't read any POSIX specs.

Ben.

I've never heard that Perl is trying to follow any
POSIX standard any more than Vim. Even a quick look at
the Perl 6 regex specs shows that Larry and the gang
are indeed doing what they please, leading the way
rather than following.
There's probably a history of regular expressions somewhere; ed definitely preceded (the original) vi, and I think sed did, too. Awk followed in sed's "footsteps", and Perl came after vi. Vim follows vi's reg-ex (with extensions) handling. Anyway, I don't think the various programs' reg-ex styles are going to merge because that would invalidate a lot of scripts, so claiming that "X's style is better than Y's style" isn't going anywhere. IMHO Vim did it the right way -- that is, it extended earlier reg-ex handling, not changed it (like Perl did).

Regards,
Chip Campbell

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to