On Fri, 6 Jul 2012 18:59:00 +0100
"Adam J. Gamble" <a.gam...@lucida.cc> wrote:

> 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?

Try:  m{ (?: .{n} | .{m} ) }msx

Of course, replace the period with the character set you're looking for.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

        _Perl links_
official site   : http://www.perl.org/
beginners' help : http://learn.perl.org/faq/beginners.html
advance help    : http://perlmonks.org/
documentation   : http://perldoc.perl.org/
news            : http://perlsphere.net/
repository      : http://www.cpan.org/
blog            : http://blogs.perl.org/
regional groups : http://www.pm.org/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to