Regex assign raising exceptions
Hi everyone, I am having some issues with the boost::regex assign method. I have been following an example on the boost site for a search and replace. However I seem to be getting an Empty Expression exception when assigning my expression to my boost:regex object. boost::regex exp; const char* expression_string = "([[:space:]](|-)[[:digit:]]+)f;"; exp.assign(expression_string); Any ideas? I have tried a few different syntax option types at the end without success. Thanks Josh Ps. I posted this in comp.lang.c++ before realising that this is probably the better place to ask boost questions :-) This message contains confidential information and is intended only for the individual(s) named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please immediately delete it and all copies of it from your system, destroy any hard copies of it, and notify the sender. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. To the maximum extent permitted by law, Immersive Technologies Pty. Ltd. does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission.
I think I got past it now. Had to change the alternation operator in the middle from (|-) to (?:)|- Cheers, Josh ________________________________ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Joshua Stewart Sent: Friday, 27 October 2006 1:10 PM To: boost-users@lists.boost.org Subject: [Boost-users] Regex assign raising exceptions Hi everyone, I am having some issues with the boost::regex assign method. I have been following an example on the boost site for a search and replace. However I seem to be getting an Empty Expression exception when assigning my expression to my boost:regex object. boost::regex exp; const char* expression_string = "([[:space:]](|-)[[:digit:]]+)f;"; exp.assign(expression_string); Any ideas? I have tried a few different syntax option types at the end without success. Thanks Josh This message contains confidential information and is intended only for the individual(s) named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please immediately delete it and all copies of it from your system, destroy any hard copies of it, and notify the sender. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. To the maximum extent permitted by law, Immersive Technologies Pty. Ltd. does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission.
Joshua Stewart wrote:
I think I got past it now.
Had to change the alternation operator in the middle from
(|-)
to
(?:)|-
Right, Boost.Regex regards empty alternatives as errors, if you really meant to have an empty alternative then simply "(-??)" would have done the job just as well as "(|-)". John.
participants (2)
-
John Maddock
-
Joshua Stewart