in reply to Oddness with regex quantifiers
The reason for the asymmetry between {MIN,} and {,MAX} is probably that there's a zero in perl, but Inf isn't generally supported.
If you wonder what {,MAX} matches, here's the answer:
$ perl -Mre=debug -ce ' /a{,5}/' Compiling REx "a{,5}" Final program: 1: EXACT <a{,5}> (4) 4: END (0) anchored "a{,5}" at 0 (checking anchored isall) minlen 5 -e syntax OK Freeing REx: "a{,5}" $ perl -wE 'say "yes" if "a{,4}" =~ /a{,4}/' yes # in contrast: $ perl -Mre=debug -ce ' /a{0,5}/' Compiling REx "a{0,5}" Final program: 1: CURLY {0,5} (5) 3: EXACT <a> (0) 5: END (0) minlen 0 -e syntax OK Freeing REx: "a{0,5}"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Oddness with regex quantifiers
by JavaFan (Canon) on Nov 23, 2010 at 23:29 UTC | |
by talexb (Chancellor) on Nov 24, 2010 at 13:40 UTC | |
|
Re^2: Oddness with regex quantifiers
by talexb (Chancellor) on Nov 23, 2010 at 21:36 UTC | |
by moritz (Cardinal) on Nov 23, 2010 at 21:38 UTC | |
by elef (Friar) on Nov 23, 2010 at 22:03 UTC | |
by ikegami (Patriarch) on Nov 23, 2010 at 22:41 UTC | |
by talexb (Chancellor) on Nov 23, 2010 at 22:14 UTC | |
by ikegami (Patriarch) on Nov 23, 2010 at 22:21 UTC | |
by ikegami (Patriarch) on Nov 23, 2010 at 22:01 UTC |