I am using the Python re
module.
I can use the regex r'\bA\b'
(a raw string) to differentiate between 'A'
and 'AA'
: it will find a match in the string 'A'
and no matches in the string 'AA'
.
I would like to achieve the same thing with a carat ^
instead of the A
: I want a regex which differentiates between '^'
and '^^'
.
The problem I have is that the regex r'\b\^\b'
does not find a match in '^
'.
Any ideas?