Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I want to search the string above, starting from the end of the string, get the 17 characters that preceed the end and see how much 'A' I have. If I have more than 14 A in the 17 characters, then the match is succesful.$string_to_match='QWERTAAWAAAAKAAAAAAAA';';
The best part is that I INDEED have 14 occcurences of 'A' in the last 17 characters.. but it does not match... Please help me!$check = substr($string_to_match, -17, 17); if ($check=~/A{14,17}/) {print "correct";}
2006-05-28 Retitled by g0n, as per Monastery guidelines
Original title: 'This error is giving me a headache!!!'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Count the number of matched characters
by borisz (Canon) on May 28, 2006 at 10:36 UTC | |
|
Re: Count the number of matched characters
by QM (Parson) on May 28, 2006 at 15:51 UTC | |
|
Re: Count the number of matched characters
by ioannis (Abbot) on May 28, 2006 at 16:03 UTC |