Hello Daniel,

Wednesday, May 4, 2005, 8:50:28 PM, you wrote:


DFS> In message <[EMAIL PROTECTED]>, Sergey Samokhodkin writes:
>>Not convinced yet. I still think there is a bug.
>>Let's look at the javadoc:
DFS> ...
>>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.

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

DFS>   echo foot | perl -pi -e 's/foo|foot/bar/g'
.......
.......
>>It obviously says about the partial rather than exact match, so
>>it simply doesn't apply.

DFS> I don't understand what you mean.

Same for me.

DFS> Perl expressions either match
DFS> something or they don't matching something.  They don't either
DFS> exactly match the thing or partially match the thing.

That's what I mean:
$str =~ /^foo$/  - check for exact match, analog to matches()
$str =~ /foo/  - check for partial match, analog to contains()

DFS> foo|foot will never match foot in Perl, plain and simple.  It
DFS> will only ever match foo, as my substitution example showed.
DFS> Awk is a different matter, because the longest possible match
DFS> will always be found.

You are referring, in essence, to the difference between the DFA- and
NFA-based matchers. I don't see how it applies to our case.

What I don't understand is, why the 'regexp("foo").matches(str)' is
diffrent in behaviour from the 'regexp("^(?:foo)$").contains(str)'.
IMHO these are the same and should behave the same.

DFS> daniel


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



-- 
Best regards,
 Sergey                            mailto:[EMAIL PROTECTED]



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

Reply via email to