Count the number of matches of a particular character in a string matched by a regex wildcard

Viewed 807

Can I keep a count of each different character matched in the regex itself ?

Suppose the regex goes looks like />(.*)[^a]+/

Can I keep a count of the occurrences of, say the letter p in the string captured by the group (.*)?

6 Answers
Related