Boost logo

Boost Users :

Subject: Re: [Boost-users] Regex win vs. linux
From: Adam Kornafeld (adam.kornafeld_at_[hidden])
Date: 2009-02-22 05:41:50


Alan, Steven, John:

indeed the presence of the trigraph was the source of the problem. The
compiler on linux even warned me, but at that time (few months ago) I
didn't take note of it, since it did not cause any trouble on linux.

Anyways, a little restructure:

boost::regex const rex("(?is)(https?)://([^:/?#]+):?(\\d{1,5})?(/[^?
#]*)?(\\?[^#]+)?(#.*)?");

has helped to come around the problem. Thanks for the help!

Regards,
==Adam

On Feb 22, 2009, at 11:00 AM, John Maddock wrote:

>> boost::regex exp("(?is)(https?)://([^:/?#]+):?(\\d{1,5})?/?([^?#]*)?\
>> \??([^#]+)?#?(\\w*)");
>>
>> It runs fine in a linux environment, however if compiled with VC9 on
>> windows, it fails with:
>
> The character sequence '??(' is a trigraph that VC++ replaces with
> '[' - see http://en.wikipedia.org/wiki/C_trigraph - and this of
> course breaks your regex :-(
>
> I'm trying to think of an alternative and failing at present, as
> splitting into 2 strings doesn't help (apparently VC++ performs
> trigraph substitution after string catenation). Ah this page: http://msdn.microsoft.com/en-us/library/bt0y4awe.aspx
> describes the workaround.
>
> HTH, John.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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