I just want to find all characters (other than A) which are followed by triple A, i.e., have AAA to the right. I don’t want to include the triple A in the output and just want the character immediately preceding AAA
result = []
s = 'ACAABAACAAABACDBADDDFSDDDFFSSSASDAFAAACBAAAFASD'
pattern = "r'(\w[BF])(?!AAA)'"
for item in re.finditer(pattern, s):
result.append(item.group())
print(result)
I used this pattern r'(\w[BF])(?!AAA)' but didn't worked
I just need find this letters in []
'ACAABAA[C]AAABACDBADDDFSDDDFFSSSASDA[F]AAAC[B]AAAFASD'