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

W

wolverine

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.
 
M

mlimber

wolverine said:
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
 
D

David Harmon

On 29 Aug 2006 03:13:17 -0700 in comp.lang.c++, "wolverine"
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top