I'm trying to count the number of "A" characters in a string that are not preceeded AND followed by a "C". So:
should come back with a count of 2 "A" characters. Any ideas/suggestions? I tried:
but count returns with 1, not 2. I guess because it's trying to find matches where A is not preceeded OR followed by a "C"????
Code:
$string = "ABCACAB";
Code:
$count = 0;
$count++ while ($string =~ m/(?<!C)A(?!C)/g);