Opened 13 years ago

Closed 13 years ago

#4036 closed Bugs (worksforme)

hang search

Reported by: propheticoleg@… Owned by: John Maddock
Milestone: Boost 1.43.0 Component: regex
Version: Boost 1.42.0 Severity: Problem
Keywords: regex_search Cc:

Description

The string with many numbers and not simple expression on numbers will hang search without any messages or exceptions.

Attachments (2)

document.txt (485 bytes ) - added by propheticoleg@… 13 years ago.
document wirh analyzing text
regular expression.txt (1.8 KB ) - added by propheticoleg@… 13 years ago.
regular expression for analyzing

Download all attachments as: .zip

Change History (3)

by propheticoleg@…, 13 years ago

Attachment: document.txt added

document wirh analyzing text

by propheticoleg@…, 13 years ago

Attachment: regular expression.txt added

regular expression for analyzing

comment:1 by John Maddock, 13 years ago

Resolution: worksforme
Status: newclosed

Works for me with current SVN Trunk and the simple test case below (throws an exception because the match takes too long to find). Please provide a self contained test case and details of the compiler used plus Boost version if you still think there is a problem.

// scrap.cpp : Def
#include "stdafx.h"

using namespace boost;
using namespace std;

int main()
{
   regex e("(?:(((((((-{0,1}((([0-9][ ]{0,1}){1,}([\\.,][ ]{0,1}([0-9][ ]{0,1}){1,}([ ]{0,1}(([\\(]([0-9]{1,3}[ ]{0,1})[\\)]))){0,1}){0,}))))[ ]{0,1}){0,1}((îäèí|îäíà|one|äâà|äâå|two|òðè|three|÷åòûðå|four|ïÿòü|five|øåñòü|six|ñåìü|seven|âîñåìü|eight|äåâÿòü|nine|äåñÿòü|ten|îäèííàäöàòü|eleven|äâåíàäöàòü|twelve|òðèíàäöàòü|thirteen|÷åòûðíàäöàòü|fourteen|ïÿòíàäöàòü|fifteen|øåñòüíàäöàòü|sixteen|ñåìíàäöàòü|seventeen|âîñåìíàäöàòü|eighteen|äåâÿòíàäöàòü|nineteen|äâàäöàòü|twenty|òðèäöàòü|thirty|ñîðîê|forty|ïÿòüäåñÿò|fifty|øåñòüäåñÿò|sixty|ñåìüäåñÿò|seventy|âîñåìüäåñÿò|eighty|äåâÿíîñòî|ninety|ñòî|äâåñòè|òðèñòà|÷åòûðåñòà|ïÿòüñîò|øåñòüñîò|ñåìüñîò|âîñåìüñîò|äåâÿòüñîò|ñîòíÿ|ñîòíè|ñîòåí|hundred and|hundred|òûñÿ÷à|òûñÿ÷è|òûñÿ÷|òûñ\\.|òûñ|thousand and|thousand|ìèëëèîíîâ|ìèëëèîíà|ìèëëèîí|ìëí\\.|ìëí|million and|million|ìèëëèàðäîâ|ìèëëèàðäà|ìèëëèàðä|ìëðä\\.|ìëðä|milliard and|milliard|billion and|billion)[ ]{0,1}){1,})|(((((-{0,1}((([0-9][ ]{0,1}){1,}([\\.,][ ]{0,1}([0-9][ ]{0,1}){1,}([ ]{0,1}(([\\(]([0-9]{1,3}[ ]{0,1})[\\)]))){0,1}){0,}))))[ ]{0,1})((îäèí|îäíà|one|äâà|äâå|two|òðè|three|÷åòûðå|four|ïÿòü|five|øåñòü|six|ñåìü|seven|âîñåìü|eight|äåâÿòü|nine|äåñÿòü|ten|îäèííàäöàòü|eleven|äâåíàäöàòü|twelve|òðèíàäöàòü|thirteen|÷åòûðíàäöàòü|fourteen|ïÿòíàäöàòü|fifteen|øåñòüíàäöàòü|sixteen|ñåìíàäöàòü|seventeen|âîñåìíàäöàòü|eighteen|äåâÿòíàäöàòü|nineteen|äâàäöàòü|twenty|òðèäöàòü|thirty|ñîðîê|forty|ïÿòüäåñÿò|fifty|øåñòüäåñÿò|sixty|ñåìüäåñÿò|seventy|âîñåìüäåñÿò|eighty|äåâÿíîñòî|ninety|ñòî|äâåñòè|òðèñòà|÷åòûðåñòà|ïÿòüñîò|øåñòüñîò|ñåìüñîò|âîñåìüñîò|äåâÿòüñîò|ñîòíÿ|ñîòíè|ñîòåí|hundred and|hundred|òûñÿ÷à|òûñÿ÷è|òûñÿ÷|òûñ\\.|òûñ|thousand and|thousand|ìèëëèîíîâ|ìèëëèîíà|ìèëëèîí|ìëí\\.|ìëí|million and|million|ìèëëèàðäîâ|ìèëëèàðäà|ìèëëèàðä|ìëðä\\.|ìëðä|milliard and|milliard|billion and|billion)[ ]{0,1}){0,}))))[ ]{0,1}(øòóê|øò\\.|øò|åäèíèö|åä\\.|åä))(?:[^A-Za-zÀ-ßà-ÿ/]|$))");
   std::string text("The following phone numbers were returned in this area code:\n\n3123484973, 3123488416, 3123488393, 3123485219, 3123480807, 3123482560, 3123483792, 3123486264, 3123484451, 3123485172, 3123486573, 3123489859, 3123482700, 3123488701, 3123480783, 3123489095, 3123488519, 3123480121, 3123482416, 3123489534, 3123483804, 3123488660, 3123485544, 3123484113, 3123480599, 3123482042, 3123488537, 3123482887, 3123483914, 3123484208, 3123482591, 3123482974, 3123488856, 3123480352, 3123484017...");

   std::cout << regex_search(text, e) << std::endl;

}

Note: See TracTickets for help on using tickets.