[Issue 7567] New: Lazy quantifiers fail with ctRegex

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 23 09:30:11 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7567

           Summary: Lazy quantifiers fail with ctRegex
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: beatgammit at gmail.com


--- Comment #0 from Jameson <beatgammit at gmail.com> 2012-02-23 09:30:07 PST ---
Overview:

ctRegex fails to compile some regular expressions that regex does.



Steps to reproduce:

The following regular expressions fail with ctRegex, put work with regex
compiled at runtime:

(a+?)?b
(a*?)?b
(a{0,}?)?b
(a{1,}?)?b



Actual Results:

I get the following error:

/usr/include/d/dmd/phobos/std/regex.d(6486): found 'else' instead of statement



Expected results:

I expected ctRegex to behave the same as regex, and compile the same set of
regular expressions.



Build:

DMD v2.058



Additional information:

The following regular expressions work with both:

(a{1,5}?)?b
a*?b
(a*?)b

It seems to be a problem with having a lazy quantifier followed by the ?.

I am building a regex to parse URIs:

^(?:(?P<scheme>[^:/?#]+):)?(?:(?P<slashes>//)?(?P<authority>[^/?#]*?)(?::(?P<port>\\d{1,5}))?)?(?P<path>/[^?#]*)(?:\\?(?P<query>[^#]*))?(?:#(?P
   <fragment>.*))?$

This works fine with the regex function, but breaks when I use ctRegex.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list