RegEx: find all occurances of a single character in a string

Franz Steinhaeusler franz.steinhaeusler at
Tue Dec 14 14:05:38 CET 2004

given a string:

    ^   ^     ^ ^ (these should be found)
I want to get the positions of all single 'a' characters.
(Without another 'a' neighbour)

So I tried: 

but this applies only for 
the a's, which has neighbours.
So I need also '^a' and 'a$'.

Am I doing something wrong? 
Is there a easier solution?
How can I quickly get all these positions?

Thank you in advance.
Franz Steinhaeusler

More information about the Python-list mailing list