In message <[EMAIL PROTECTED]>, Sergey Samokhodkin writes:
>Not convinced yet. I still think there is a bug.
>Let's look at the javadoc:
...
>I cannot see where the perlre allows the "foo|foot" not to produce the
>exact match against "foot", which takes place in the case in question.

I don't see how the javadoc can be any clearer about explaining the
behavior.  Run this test yourself and see:

  echo foot | perl -pi -e 's/foo|foot/bar/g'

The result will not be bar, it's bart.  If you want foo|foot to match
foot you've either got to rewrite it as foot|foo or as ^(?:foo|foot)$.
For example,

  echo foot | perl -pi -e 's/^(?:foo|foot)$/bar/g'

will produce bar and not bart.

>It obviously says about the partial rather than exact match, so
>it simply doesn't apply.

I don't understand what you mean.  Perl expressions either match
something or they don't matching something.  They don't either
exactly match the thing or partially match the thing.
foo|foot will never match foot in Perl, plain and simple.  It
will only ever match foo, as my substitution example showed.
Awk is a different matter, because the longest possible match
will always be found.

daniel


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to