RE: [Boost-users] Regex lookahead/lookbehind
*** Before acting on this e-mail or opening any attachment you are advised to read the disclaimer at the end of this e-mail *** Hi John,
-----Original Message----- From: John Maddock [mailto:john@johnmaddock.co.uk] Sent: 15 June 2004 12:40 To: boost-users@lists.boost.org Subject: Re: [Boost-users] Regex lookahead/lookbehind
Hi all,
Is it possible to do lookahead and/or lookbehind within boost::regex?
Lookahead is supported at present, lookbehind will be in the next revision (currently in cvs in the branch called regex5).
John.
Thanks for the quick response. In the end I managed to solve my current problem without needing lookahead or lookbehind. I used your (earlier) advice of checking for word boundaries at the beginning and end of my regular expression and this has helped loads! The latest version of my postcode validation expression is shown below: (\bGIR\s0AA\b)| (\b[^QVX\W0-9][^IJZ\W\s]([0-9]{1,2}?|[ABCDEFGHJKSTUW0-9]?|[0-9][ABEHMNPRVWXY ]?) \s+\d[^CIKMOV]{2}\b) I'm certain that the expression could be made simpler and that it could also be made more efficient but I'm not sure where. Cheers, James ********************************************************************** Please note: This e-mail and its attachments contain only the opinions of the sender and do not necessarily reflect the policy(s) of the communisis group in general. Employees of the communisis group are required not to make any defamatory statements and not to infringe or authorise any infringement of copyright or any other legal right by e-mail. Any such communication is therefore outside the scope of employment of the individual concerned. The communisis group will not accept any liability in respect of such a communication. Confidentiality: This e-mail and any attachments, together with their contents, are confidential unless otherwise explicitly stated in writing by the sender of this e-mail and are for the intended recipient only. If they have come to you in error you must not take any action in respect of them, which includes but is not limited to reproducing, sending or storing them, other than to notifying the sender immediately of the mistake, and deleting the e-mail, any attachments and any reproductions made by replying to it. Viruses: This e-mail and any attachments have been scanned for viruses but we cannot guarantee that they are virus free. The recipient should check this e-mail and any attachments for viruses. The communisis group accepts no responsibility for any damage caused by any virus transmitted by this e-mail or any of its attachments. In the event of any unauthorised copying or forwarding, the recipient will be required to indemnify the communisis group against any claim for loss or damage caused by any viruses or otherwise. ********************************************************************** ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
participants (1)
-
James Gunn