|
Boost : |
From: Mathew Robertson (mathew.robertson_at_[hidden])
Date: 2005-02-02 22:40:20
I suspect that
[[:alphanum:]][-[:alphanum:]]*
is what is killing you... I'm not even sure what you are trying to match...
BTW: do you need to use capturing (ie parenthesis)? capturing can use lots of memory as well...
Mathew
----- Original Message -----
From: "Preston A. Elder" <prez_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, February 03, 2005 2:13 PM
Subject: [boost] Simple regex problem
> Hum,
>
> Consider the following application (running on Linux with GCC):
>
> === BEGIN CODE
> #include <boost/regex.hpp>
> #include <iostream>
> #include <exception>
> #include <typeinfo>
>
> int main()
> {
> try
> {
> std::string rx_string =
> "^([[:alpha:]][-[:alnum:]]*[[:space:]]*)+$";
> boost::regex rx(rx_string, boost::regex_constants::char_classes |
> boost::regex_constants::intervals);
> std::string test = "GlobalMSG HelpServ DevNull";
>
> if (boost::regex_match(test, rx))
> std::cout << "Matched." << std::endl;
> else
> std::cout << "Not Matched." << std::endl;
> }
> catch (const std::exception &e)
> {
> std::cout << "Exception " << typeid(e).name() << ": " << e.what()
> << std::endl;
> }
>
> return 0;
> }
> === END CODE
>
> The result of running this is:
> Exception N5boost14bad_expressionE: Memory exhausted
>
> My question is, why? The regex is simple enough, and the source string is
> quite short. Please note, the same regex with the test string of:
> "OperServ Magick-1"
>
> runs and completes successfully without a problem.
>
> Any ideas on how to fix this?
>
> --
> PreZ :)
> Founder. The Neuromancy Society (http://www.neuromancy.net)
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk