473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 3724
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: derek.google | last post by:
I hope a Boost question is not too off-topic here. It seems that upgrading to Boost 1.33 broke some old regex code that used to work. I have reduced the problem to this simple example: cout <<...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
5
by: FBergemann | last post by:
I use SunOS 5.8, gcc 3.3.2, boost 1.33.1. I have build the entire boost package and try to compile a simple example: #include <iostream> #include <string> #include <boost/regex.hpp //...
4
by: DSmith1974 | last post by:
Are lookarounds supported in the boost regex lib? In my VS6 project using boost 1.32.0 I can declare a regex as.. <code_snippet> std::wstring wstrFilename = L"01_BAR08"; boost::wregex...
1
by: Yahooooooooo | last post by:
Just practicing BOOST regular expressions....giving errors... -- wanted to replace SPACE with NULL. #include <iostream> #include <fstream> #include <sstream> #include <string> #include...
3
by: MCH | last post by:
hi there, I am working with a HTML-like text with boost:regex. For example, the following pattern might occur in my text <abc efg> <p>EFG</p 12<3> In this case, I would like to extract...
3
by: ambarish.mitra | last post by:
Code snippet: #include <iostream> #include <string> #include <boost/regex.hpp // Boost.Regex lib using namespace std; int main( ) {
0
by: Zorg | last post by:
Hello, I try to compile this example : http://www.boost.org/libs/regex/example/snippets/captures_example.cpp but I get this error : ~/developpement/essai_regex/boost$ g++ -o test...
0
by: Zorg | last post by:
Hello, I try to compile this example : http://www.boost.org/libs/regex/example/snippets/captures_example.cpp but I get this error : ~/developpement/essai_regex/boost$ g++ -o test...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.