develooper Front page | perl.beginners | Postings from July 2012

Regex character classes: n OR m

Thread Next
From:
Adam J. Gamble
Date:
July 6, 2012 10:59
Subject:
Regex character classes: n OR m
Message ID:
CAKi0ETgXZtpcv_KVZ-80kf_gK18szqKd083T351Gd8FJ8rRD+A@mail.gmail.com
Dear All,

I'm taking a (highly belated) first look at Perl today. From a background
in Python, I'm coming to Perl, primarily out of curiosity with what it can
do with regular expressions.

To get to the point— is it possible to match a character class with a
repeater that requires an exactly *n* OR *m* matches, rather than the
traditional *{n, m}*. I've taken a look at
http://perldoc.perl.org/perlrequick.html#Using-character-classes, which
implies this wouldn't be possible? But, putting faith Perl's reputation for
inherent quirkiness... if possible, I'd love to know what a solution would
look like?

Adam


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About