[Boost-bugs] [Boost C++ Libraries] #3513: regex_match very slow example

Subject: [Boost-bugs] [Boost C++ Libraries] #3513: regex_match very slow example
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-10-07 17:54:39


#3513: regex_match very slow example
-----------------------------------------------------------+----------------
 Reporter: Fernando Pelliccioni <fpelliccioni@…> | Owner: eric_niebler
     Type: Support Requests | Status: new
Milestone: Boost 1.41.0 | Component: xpressive
  Version: Boost 1.40.0 | Severity: Problem
 Keywords: |
-----------------------------------------------------------+----------------
 Hi,

 I am having an issue with a dynamic regular expresion.

 I have this source code.

 sregex tempRE = sregex::compile("^(?:.*\\r?\\n)*var wlanPara = new
 Array\\(\\r?\\n\\d{0,4},\\r?\\n\"(?P<ssid>(?:\\w+))\",\\r?\\n(?P<channel>(?:\\d{0,4})),\\r?\\n\\d{0,4},\\r?\\n\"[\\w-]+\",\\r?\\n\"[\\w\\.]+\",\\r?\\n\\d{0,4},\\r?\\n\\d{0,4},\\r?\\n\"(?P<signal>(?:\\d{0,4}))
 dB\",\\r?\\n\\d{0,4},\\d{0,4} \\);(?:.*\\r?\\n)*$");

 std::string htmlText; // filled using text in html file attached


 smatch what;

 if(regex_match(htmlText, what, tempRE))
 {
         //...
 }

 When the program enters to the regex_match function, the process consumes
 50% of the processor and the function never returns.

 I was attach the html file that contains the text.
 The source code was tested using VisualStudio 2008.


 If I use the static variant of regex, it's works perfectly..

 sregex tempRE = bos >> *_ >> "var wlanPara = new Array(" >> _ln >> _d >>
 commonDigit >> ',' >> _ln >> '"' >> (s1= +_w) >> "\"," >> _ln >> (s2=
 commonDigit) >> ',' >> _ln >> commonDigit >> ',' >> _ln >> '"' >> +(_w |
 '-') >> "\"," >> _ln >> '"' >> +(_w | '.') >> "\"," >> _ln >> commonDigit
>> ',' >> _ln >> commonDigit >> ',' >> _ln >> '"' >> (s3= commonDigit) >>
 " dB\"," >> _ln >> commonDigit >> ',' >> commonDigit >> " );" >> *_ >>
 eos;



 Thanks,

 Fernando Pelliccioni

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3513>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC