The question mark is a quantifier
$ perl -le " qr{\d****} " Nested quantifiers in regex; marked by <-- HERE in m/\d** <-- HERE **/ + at -e line 1. $ perl -le " qr{(?#an error follows)****} " Quantifier follows nothing in regex; marked by <-- HERE in m/(?#an err +or follows)* <-- HERE ***/ at -e line 1. $ perl -le " qr{?} " Quantifier follows nothing in regex; marked by <-- HERE in m/? <-- HER +E / at -e line 1.
You need to learn to character class :) See perlrecharclass
Try <token: punctuation> ( [.,?!"';:\-&()\[\]]+ )
See also RFC: A walkthrough from JSON ABNF to Regexp::Grammars and The usage of <ALIAS=\IDENT> of Regexp::Grammars
In reply to Re: Quantifier follows nothing error in Regexp::Grammars (quantifier "?")
by Anonymous Monk
in thread Quantifier follows nothing error in Regexp::Grammars
by nathaniels
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |