|
Posted by Tim Roberts on 05/14/05 09:52
Henri Schomaecker <hs@byteconcepts.de> wrote:
>
>I solved it. It was a greedy problem.
>I just don't understand why in PHP .* catches far over the (...) when I
>don't set the N (non-greedy) Option. - In my Opinion it should at least
>stop matching, when the match-making ) is reached. - But it doesn't!
That's your opinion, because it conveniently suits your current
requirement. Regular expressions have been greedy right from the start.
>In perl, this is no problem, I tried a few one-liners with the g option
>(perl's greedy option) with my example now.
Perl is greedy by default (as are all regular expression matchers).
Perhaps you should post your test so we can figure out what you really did.
>PHP seems to match, and match ..., and does not stop with matching until the
>end of the subject string is found.
Please post your exact tests. I want to make sure we can explain this to
everyone.
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
Navigation:
[Reply to this message]
|