Wednesday, May 4, 2011

Re: Help me please ^^

[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.

/bpj

--
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

No comments: