[regex] why character class [:xdigit:] does not work in my sample example ??
Hello, Why does the boost regex sample program attached here, doesnot generate match for character class [:xdigit:] Do we need to enable this character class explicity? If yes, how to enable it? Regards, Chandan ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front
Chandan Nilange wrote:
Hello,
Why does the boost regex sample program attached here, doesnot generate match for character class [:xdigit:] Do we need to enable this character class explicity? If yes, how to enable it?
The expression "[:xdigit:]" that you're using will match any of the characters ":", , "x", "d", "i", "g" or "t". Use "[[:xdigit:]]" to match a hex digit character. John.
Thank you John for your prompt reply. I tried the same example by replacing [:xdigit:] with [[:xdigit:]] in the expression However, I still do not get the desired match. Regards, Chandan John Maddock <john@johnmaddock.co.uk> wrote: Chandan Nilange wrote:
Hello,
Why does the boost regex sample program attached here, doesnot generate match for character class [:xdigit:] Do we need to enable this character class explicity? If yes, how to enable it?
The expression "[:xdigit:]" that you're using will match any of the characters ":", , "x", "d", "i", "g" or "t". Use "[[:xdigit:]]" to match a hex digit character. John. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users --------------------------------- Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
Chandan Nilange wrote:
Thank you John for your prompt reply. I tried the same example by replacing [:xdigit:] with [[:xdigit:]] in the expression However, I still do not get the desired match.
Works for me with 1.34, I see: Found Pattern:start:1PAGE1ERROR1:end: Pattern starts at :31 Pattern ends at: 42 Pattern length:12 as output. For some older Boost versions though you may need to use: re.assign(sre, boost::regex_constants::perl | boost::regex_constants::icase); Otherwise the expression is interpreted as a POSIX-Basic regex which isn't what you want. John.
Hello John, Thanks, it generates match correctly after using [re.assign(sre,boost::regex_constants::perl | boost::regex_constants::icase);] I am using BOOST_LIB_VERSION "1_32" which comes with RHEL 4 (linux ) installation. Could you help me to know, where I can get the document stating differences between boost version 1.34 & 1.32 for regex library. I need to decide whether to shift to 1.34 boost version is a must for me. Thanks & Regards, Chandan --- John Maddock <john@johnmaddock.co.uk> wrote:
Thank you John for your prompt reply. I tried the same example by replacing [:xdigit:] with [[:xdigit:]] in the expression However, I still do not get
Chandan Nilange wrote: the desired match.
Works for me with 1.34, I see:
Found Pattern:start:1PAGE1ERROR1:end: Pattern starts at :31 Pattern ends at: 42 Pattern length:12
as output.
For some older Boost versions though you may need to use:
re.assign(sre, boost::regex_constants::perl | boost::regex_constants::icase);
Otherwise the expression is interpreted as a POSIX-Basic regex which isn't what you want.
John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
____________________________________________________________________________________ Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC
Chandan Nilange wrote:
Hello John,
Thanks, it generates match correctly after using [re.assign(sre,boost::regex_constants::perl | boost::regex_constants::icase);]
I am using BOOST_LIB_VERSION "1_32" which comes with RHEL 4 (linux ) installation. Could you help me to know, where I can get the document stating differences between boost version 1.34 & 1.32 for regex library. I need to decide whether to shift to 1.34 boost version is a must for me.
Hello, Can boost_regex handle overlapping matches. e.g RegularExpression=> "12345678901\\d" String=> "12345678901123456789012" Should generate following 2 Matches: 1st Matching Pattern:123456789011 Pattern starts at :0 Pattern ends at: 11 Pattern length:12 2nd Matching Pattern:123456789012 Pattern starts at :11 Pattern ends at: 22 Pattern length:12 I know, the documention talks only about non-overlapping matches. Just want to know if overlapping-matches support is likely to be added to boost_regex. Regards, Chandan ____________________________________________________________________________________ Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/
Chandan Nilange wrote:
Hello,
Can boost_regex handle overlapping matches.
e.g RegularExpression=> "12345678901\\d" String=> "12345678901123456789012"
Should generate following 2 Matches: 1st Matching Pattern:123456789011 Pattern starts at :0 Pattern ends at: 11 Pattern length:12 2nd Matching Pattern:123456789012 Pattern starts at :11 Pattern ends at: 22 Pattern length:12
I know, the documention talks only about non-overlapping matches. Just want to know if overlapping-matches support is likely to be added to boost_regex.
It's not explicitly handled, but it's more or less trivial to use regex_search to repeatedly search for overlapping matches. John.
Hello John, I tried to run the regex_search example on the page http://www.boost.org/libs/regex/example/snippets/regex_search_example.cpp with BOOST_LIB_VERSION "1_32" However, I get the following compilation error multiple times: /tmp/ccy6kuZL.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcEESaIcEEC1ES6_S6_RNS_13match_resultsIS6_S9_EERKNS_14reg_expressionIcSB_SC_EENS_15regex_constants12_match_flagsE+0x7e): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char>, std::allocator<char>
::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > &, boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&, boost::regex_constants::_match_flags)': : undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> ::get_traits() const'
Please help. Also, could you please elaborate more on how to achieve overlapping matches using regex_search. Regards, Chandan --- John Maddock <john@johnmaddock.co.uk> wrote:
Chandan Nilange wrote:
Hello,
Can boost_regex handle overlapping matches.
It's not explicitly handled, but it's more or less trivial to use regex_search to repeatedly search for overlapping matches.
John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
____________________________________________________________________________________ Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=list&sid=396545433
Chandan Nilange wrote:
Hello John,
I tried to run the regex_search example on the page http://www.boost.org/libs/regex/example/snippets/regex_search_example.cpp with BOOST_LIB_VERSION "1_32"
However, I get the following compilation error multiple times:
/tmp/ccy6kuZL.o(.gnu.linkonce.t._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcEESaIcEEC1ES6_S6_RNS_13match_resultsIS6_S9_EERKNS_14reg_expressionIcSB_SC_EENS_15regex_constants12_match_flagsE+0x7e): In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char>, std::allocator<char>
perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > &, boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> > const&, boost::regex_constants::_match_flags)': undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char> get_traits() const'
Please help.
Those are link time messages, and crucially you've omitted the actual error! You do sometimes get *warnings* like that if your binutils and gcc packages are differing in versions.
Also, could you please elaborate more on how to achieve overlapping matches using regex_search.
i,j; // iterators to search through smatch what; regex re("something"); while(regex_search(i, j, what, re) && (i != j)) { do_something(what); ++i; } John.
Hello John, Thanks John, I think, I can now use boost regex_search for verification. ( of a regex engine built in hardware) Also Sorry to bother you, the compilation error were due to, not including boost_regex library during compilation. Regards, Chandan. --- John Maddock <john@johnmaddock.co.uk> wrote:
undefined reference to `boost::reg_expression<char, boost::regex_traits<char>, std::allocator<char>
get_traits() const'
Please help.
Those are link time messages, and crucially you've omitted the actual error!
You do sometimes get *warnings* like that if your binutils and gcc packages are differing in versions.
Also, could you please elaborate more on how to achieve overlapping matches using regex_search.
i,j; // iterators to search through smatch what; regex re("something");
while(regex_search(i, j, what, re) && (i != j)) { do_something(what); ++i; }
John.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news
participants (2)
-
Chandan Nilange
-
John Maddock