Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: match a range of characters multiple times but they might scattered in the string

by AnomalousMonk (Abbot)
on Feb 27, 2013 at 01:23 UTC ( #1020791=note: print w/ replies, xml ) Need Help??


in reply to Re: match a range of characters multiple times but they might scattered in the string
in thread match a range of characters multiple times but they might scattered in the string

Could also count using  tr/// (wish I'd thought of that!).

>perl -wMstrict -le "for my $s (qw( AAA RR XXK AxA xAxxYxxRx A xAx ARKYGZX XxZxGxYxKxRxA AxAxAxA xYYYYx xRRRRRx RRRR )) { my $n = $s =~ tr{ARKYGZX}{}; printf qq{%s match : '%s' \n}, ($n == 2 || $n == 3) ? ' ' : 'NO', $s; } " match : 'AAA' match : 'RR' match : 'XXK' match : 'AxA' match : 'xAxxYxxRx' NO match : 'A' NO match : 'xAx' NO match : 'ARKYGZX' NO match : 'XxZxGxYxKxRxA' NO match : 'AxAxAxA' NO match : 'xYYYYx' NO match : 'xRRRRRx' NO match : 'RRRR'


Comment on Re^2: match a range of characters multiple times but they might scattered in the string
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020791]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (16)
As of 2015-07-01 16:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (11 votes), past polls