problem with boost regex search
hello, When I enter the following reg-ex: "^.*ab+c+d+" for the following text: "aaaabbbcccdddee" the text found is:"aaaabbbcccd". The text found should be: "aaaabbbcccddd". Digging deeper, its seems that the reg-ex function ignores the last character if it is a "+". This is just using boost::regex_search with the flags = boost::match_any and boost::match_not_null Am I missing something here?
When I enter the following reg-ex: "^.*ab+c+d+" for the following text: "aaaabbbcccdddee" the text found is:"aaaabbbcccd". The text found should be: "aaaabbbcccddd". Digging deeper, its seems that the reg-ex function ignores the last character if it is a "+".
This is just using boost::regex_search with the flags = boost::match_any and boost::match_not_null
Am I missing something here?
Yep, match_any says to the regex engine "I don't care what the match is, only if there is one", so it makes certain optimizations that result in the shorter string being found. Stop using the match_any flag and you'll get regular Perl-like behavior. HTH, John.
Thanks John.
On Tue, Feb 24, 2009 at 3:09 AM, John Maddock
When I enter the following reg-ex: "^.*ab+c+d+" for the following text:
"aaaabbbcccdddee" the text found is:"aaaabbbcccd". The text found should be: "aaaabbbcccddd". Digging deeper, its seems that the reg-ex function ignores the last character if it is a "+".
This is just using boost::regex_search with the flags = boost::match_any and boost::match_not_null
Am I missing something here?
Yep, match_any says to the regex engine "I don't care what the match is, only if there is one", so it makes certain optimizations that result in the shorter string being found. Stop using the match_any flag and you'll get regular Perl-like behavior.
HTH, John. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hello,
I am trying to create a boost::variant from a joint_view sequence of two
mpl sequences.
Can someone tell me what's wrong in the following example. I can't get
this to compile using MSVC 2005.
Thanks,
Naveen
#include <iostream>
#include <string>
#include
AMDG Naveen Santhanam wrote:
I am trying to create a boost::variant from a joint_view sequence of two mpl sequences.
Can someone tell me what’s wrong in the following example. I can’t get this to compile using MSVC 2005.
Variant doesn't handle views properly. Copy the joint_view into an mpl::vector. In Christ, Steven Watanabe P.S. Starting a new thread is better than replying to an unrelated thread.
participants (4)
-
Guy LaCrosse
-
John Maddock
-
Naveen Santhanam
-
Steven Watanabe