Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by AnomalousMonk (Monsignor)
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 chilling in the Monastery: (6)
As of 2014-07-30 22:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (241 votes), past polls