Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regex match hang up #4675

Closed
p6rt opened this issue Oct 23, 2015 · 4 comments
Closed

regex match hang up #4675

p6rt opened this issue Oct 23, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Oct 23, 2015

Migrated from rt.perl.org#126438 (status was 'resolved')

Searchable as RT126438$

@p6rt
Copy link
Author

p6rt commented Oct 23, 2015

From blackcatoverwall@gmail.com

The below code will hang up.

source​:

say '+0877' ~~ /^+/;

I think it should be /^\+/

@p6rt
Copy link
Author

p6rt commented Oct 27, 2015

From @jnthn

On Fri Oct 23 10​:26​:30 2015, blackcatoverwall@​gmail.com wrote​:

The below code will hang up.

source​:

say '+0877' ~~ /^+/;

I think it should be /^\+/

Yes, you need to quote of backslash the +. The hang is because ^ never matches any chars, so doesn't make progress, so quantifying it will just hang there forever. Since such a thing is non-sensical, it's now outlawed at compile time​:

===SORRY!=== Error while compiling -e
Can only quantify a construct that produces a match
at -e​:1
------> say '+0877' ~~ /^+<HERE>/;

Tests in S05-metachars/line-anchors.t.

@p6rt
Copy link
Author

p6rt commented Oct 27, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt closed this as completed Oct 27, 2015
@p6rt
Copy link
Author

p6rt commented Oct 27, 2015

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant