|
Boost Users : |
From: John Maddock (john_at_[hidden])
Date: 2006-12-19 05:24:12
Detlef Meyer-Eltz wrote:
> Thank you for your quick reply. It's just because of the
> leftmost-longest rule, that I'm indeed using POSIX extended style
> (from boost 1.33.1 with Borland CBuilder 6). To assert, that I didn't
> do anything wrong im my software, I now have made an extra commandline
> program:
I see the same output, here's what's happening with the leftmost longest
rule:
1 Find the leftmost match, if there is only one match possible at this
location then return it.
There are two matches at position 0, carry on...
2) Find the longest of the possible matches, along with any ties. If there
is only one such possible match then return it.
Both are equal length carry on....
3) If there are no marked sub-expressions, then all the remaining
alternatives are indistinguishable; return the first of these found.
Doesn't apply, carry on...
4) Find the match which has matched the first sub-expression in the leftmost
position, along with any ties. If there is only on such match possible then
return it.
There is only one match with $1 matched: the first alternative. So we
return it.
We don't get to these:
5) Find the match which has the longest match for the first sub-expression,
along with any ties. If there is only one such match then return it.
6) Repeat steps 3 and 4 for each additional marked sub-expression.
If there is still more than one possible match remaining, then they are
indistinguishable; return the first one found.
If you change the expression to
"<[^>]*>|<body([^>]*)>"
The the presence of a marked sub-expression on the second alternative breaks
the tie, and the second alternative is returned.
I know this wasn't what you were looking for, but I hope this explanation
helps!
John.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net