Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-07-28 05:06:01


yogendra karki wrote:
>> Hello all,
>> i am using boost regex to check the syntax of a URL. the regex is as
>> :-
>>
>> static const char *URLSYNTAXREGEX =
>> "^((file|https?|ftp)://)?(([-a-zA-Z0-9_]+[.]{1})+(([-a-zA-Z0-9]+))([:]{1}([0-9]+)){0,1})([?/][^[:space:]]*)?"
>>
>> the function for evaluation is:-
>>
>> bool URLHandler::EvaluateRegex(const char *regularexp,std::string
>> url){ boost::smatch what;
>> boost::regex exp(regularexp,boost::regex::extended);
>> boost::regex_search(url,what,exp);
>> std::string search=(std::string)what[0];
>> if(search.length() == url.length())
>> {
>> return true;
>> }
>> else
>> {
>> return false;
>> }
>> }
>>
>> when i am running this code with single thread it is running fine.
>> But when i am integrating this code with a multithreaded application
>> it is giving this error:-
>>
>> terminate called after throwing an instance of 'boost::regex_error'
>> what(): Invalid content of repeat range
>> Aborted
>>
>> Can you please help me in this. Its very urgent for me.

Well plainly that shouldn't happen: as a first step I would get your
debugger to break on thrown exceptions, then walk up the stack and verify
that the regex being passed is actually valid. If you suspect a regex bug
then you will have to supply a test case so I can reproduce the issue here.

Regards, John Maddock.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net