468,513 Members | 1,837 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

boost regex --- sregex_iterator -- Regular expression too big

Hi all,

I am using sregex_iterator to parse an html file like below

//content of an html page is store in the below variable
string htmlFile;
sregex_iterator itr(htmlFile.begin(), htmlFile.end(), regExpr);

But that is throwing and std::runtime_error exception with message
"Regular expression too big". What can i do to avoid this ?
I went through http://www.boost.org/libs/regex/doc/configuration.html
and changed the variables like below

#define BOOST_REGEX_USE_CPP_LOCALE
#define BOOST_REGEX_NON_RECURSIVE

#ifdef BOOST_REGEX_BLOCKSIZE
#undef BOOST_REGEX_BLOCKSIZE
#endif
#define BOOST_REGEX_BLOCKSIZE 40960

#ifdef BOOST_REGEX_MAX_BLOCKS
#undef BOOST_REGEX_MAX_BLOCKS
#endif
#define BOOST_REGEX_MAX_BLOCKS 1024

Even after that i am getting the same error message. How can i solve
this error ?

Thanks In Advance
Kiran.

Aug 29 '06 #1
2 3559
wolverine wrote:
Hi all,

I am using sregex_iterator to parse an html file like below

//content of an html page is store in the below variable
string htmlFile;
sregex_iterator itr(htmlFile.begin(), htmlFile.end(), regExpr);

But that is throwing and std::runtime_error exception with message
"Regular expression too big". What can i do to avoid this ?
I went through http://www.boost.org/libs/regex/doc/configuration.html
and changed the variables like below

#define BOOST_REGEX_USE_CPP_LOCALE
#define BOOST_REGEX_NON_RECURSIVE

#ifdef BOOST_REGEX_BLOCKSIZE
#undef BOOST_REGEX_BLOCKSIZE
#endif
#define BOOST_REGEX_BLOCKSIZE 40960

#ifdef BOOST_REGEX_MAX_BLOCKS
#undef BOOST_REGEX_MAX_BLOCKS
#endif
#define BOOST_REGEX_MAX_BLOCKS 1024

Even after that i am getting the same error message. How can i solve
this error ?

Thanks In Advance
Kiran.
Not sure. You may want to ask on the Boost user list.

Cheers! --M

Aug 29 '06 #2
On 29 Aug 2006 03:13:17 -0700 in comp.lang.c++, "wolverine"
<ki*********@gmail.comwrote,
I am using sregex_iterator to parse an html file like below

//content of an html page is store in the below variable
string htmlFile;
sregex_iterator itr(htmlFile.begin(), htmlFile.end(), regExpr);

But that is throwing and std::runtime_error exception with message
"Regular expression too big".
Perhaps that exception is thrown not by the code above, but rather
when regExpr itself is constructed? Perhaps it is written in some
recursive way that makes it effectively infinite? Perhaps you could
test the concept with a simpler file and expr that you know to be
small?

Aug 29 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by derek.google | last post: by
17 posts views Thread by clintonG | last post: by
5 posts views Thread by FBergemann | last post: by
1 post views Thread by Yahooooooooo | last post: by
3 posts views Thread by MCH | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.