|
Boost : |
From: Lorenzo Bettini (bettini_at_[hidden])
Date: 2007-08-01 10:36:41
Hi
I have to split a regular expression of the shape (simplified for this
example)
(?:\<(or)\>)|((?:[[:word:]]+)[[:blank:]]*(?=\())
the idea is to match (actually with regex_search algorithm) or as a
keyword and to match function names in function invocations (or
declarations); i.e.,
or (
should be matched as the keyword "or" and then a parenthesis, but
foo (
"foo" should be matched as a function name
the above expression works correctly (and I've always used that one).
Now, I had to split that expression into two regular expressions
(?:\<(or)\>)
((?:[[:word:]]+)[[:blank:]]*(?=\())
and try to match the above situations the same way.
Thus, I'm trying to match each one and then take the one that matched
first with the biggest length (and smallest prefix but this is not
important now);
of course I don't get the desired behavior, since in
or (
"or" is matched as a function name.
Thus I was wondering: which is the actual algorithm used by
regex_search? Does it take into consideration other things beside the
biggest length?
thanks in advance
Lorenzo
-- Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze ICQ# lbetto, 16080134 (GNU/Linux User # 158233) HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com http://www.gnu.org/software/src-highlite http://www.gnu.org/software/gengetopt http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk