D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7567 - Lazy quantifiers fail with ctRegex
Summary: Lazy quantifiers fail with ctRegex
Status: RESOLVED DUPLICATE of issue 7810
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-23 09:30 UTC by tyler-dev
Modified: 2012-04-19 09:36 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description tyler-dev 2012-02-23 09:30:07 UTC
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.
Comment 1 Dmitry Olshansky 2012-04-19 09:36:11 UTC
And right after this message I get the well known thingie: 

Error: assert(this.ir[orStart].code() == cast(IR)129u) failed C:\dmd2\src\phobos\std\regex.d	1150	

So it's a duplicate of bug 7810 but the end result is more obscure.

*** This issue has been marked as a duplicate of issue 7810 ***