Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Perl Complains of Nested Quantifiers

by ww (Archbishop)
on May 22, 2012 at 15:52 UTC ( #971817=note: print w/replies, xml ) Need Help??

in reply to Perl Complains of Nested Quantifiers

Since you're seeking help, you'd better explain what you mean by "change my previously greedy quantification into a possessive modality" -- perhaps with a description of your intent that actually provides comprehensible information. And it wouldn't hurt to show a (small) sample of your data and your desired output (and possibly, explain why the last part of the code sample in para 1, ($meanSearchTerm) doesn't match the error message you posted.

BTW, Perl 5.14 on win7 executes your sample (minus the ($meanSearchTerm) without squawking:

C:>perl -e "my $foo='123.123';$foo =~/(\d++\.\d++)/oi; print $1;" 123.123 C:>

Update/afterthought: I was actually well started writing an explanation of why that wouldn't compile when I decided to check. Once again, testing saves my butt.

Replies are listed 'Best First'.
Re^2: Perl Complains of Nested Quantifiers
by sunmaz (Novice) on May 22, 2012 at 16:15 UTC

    Please refer to my above reply. I hope that is sufficiently detailed.

    It is curious that it works on 5.14. It does not on the version I am running (5.8.8).

      I think "Possessive Quantifiers" in perl5100delta Regular-expressions explains the version dependency. I am on 5.12.2, and here is what re shows:
      $ perl -Mre=debug -e '/\d++/' Compiling REx "\d++" synthetic stclass "ANYOF[0-9][{unicode_all}]". Final program: 1: SUSPEND (7) 3: PLUS (5) 4: DIGIT (0) 5: SUCCEED (0) 6: TAIL (7) 7: END (0) stclass ANYOF[0-9][{unicode_all}] minlen 1 Freeing REx: "\d++" $ $ $ perl -Mre=debug -e '/\d+++/' Compiling REx "\d+++" Nested quantifiers in regex; marked by <-- HERE in m/\d+++ <-- HERE / +at -e line 1. $

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971817]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2018-07-21 15:41 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (449 votes). Check out past polls.