|
Boost Users : |
From: Eric Niebler (eric_at_[hidden])
Date: 2006-03-28 01:48:57
Michael Primeaux wrote:
> I'm using the latest version of the boost regex libraries and am
> receiving an exception when using the regex_replace function with the
> following regular expression:
>
> (?i)(?<!')((<\s*OBJECT\s*[^>]+classid="clsid:[^>]+?(?<!\s*/\s*)>[^*]+?<\s*/\s*OBJECT\s*>)|(<\s*OBJECT\s*[^>]+classid=\s*\"clsid:[^/>]+/))
>
> ...which works in other industry standard regex library routines.
>
> I seem to be failing on line 767 of basic_regex_creator.hpp.
>
> Any assistance is appreciated.
>
If I had to guess, I'd say the problem is "(?<!\\s*/\\s*)". This is a
negative look-behind assertion. For most regex engines out there,
look-behinds only work for fixed-width sub-expressions, like (?<!foo),
which asserts that the previous 3 characters are not "foo". Your's is a
variable-width look-behind, and I'm pretty sure Boost.Regex can't handle
that.
Which other "industry standard" regex library handles this? Perl doesn't
allow variable-width look-behinds. The only one I'm aware of which
allows this is GRETA (which I wrote many moons ago).
-- Eric Niebler Boost Consulting www.boost-consulting.com
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