Boost::Xpressive::sregex uri pattern match

172 Views Asked by At

I've been searching and testing regex's to match all uris but I can't seem to find one that matches all or most of them. Lots of the ones I've tried throw a compile error. Does anyone have an Xpressive::sRegex compatible regex?

1

There are 1 best solutions below

0
On

Something you can start from:

using namespace boost::xpressive;

static const sregex re = _b >> (s1 = +(~(set= ':', '/', '?', '#')))
                            >> as_xpr("://")
                            >> (s2 = *(~(set= '/', '?', '#')))
                            >> (s3 = *(~(set= '?', '#')))
                            >> !(as_xpr('?') >> (s4 = *(~(set='#'))))
                            >> !(as_xpr('#') >> (s5 = *_)) >> _b;