|P is for Practical|
match a range of characters multiple times but they might scattered in the stringby lrl1997 (Novice)
|on Feb 27, 2013 at 00:45 UTC||Need Help??|
lrl1997 has asked for the
wisdom of the Perl Monks concerning the following question:
I'd like to do a regex match using perl.
Say I want to search strings containing more than 2 but not more than 3 of a range of characters "ARKYGZX", any letters can be repeats (i.e. AAA, RR, XXK etc) or scattered in the string (i.e. AgoodApeople, XgoodpeopleK, etc), so that as an example, the following strings should be print out as output:
but "ARKYgoodpeopleGZX" shouldn't.
my code is as:
But I think this only works if any of the character are repeats, such as "AAgoodpeople", for strings AgoodpeopleA", or "AXgoodpeople" or "AgoodpeopleX", this code wouldn't work.