in reply to Perl Matching
The easiest might be to count the quotes with a function such as tr:
It could also be done with s///, but likely to be slightly slower.