I have code as below. I want to find cases where word "eve" is present
My conditions are
there shouldn't be any numbers or alphabets after or before "eve"
before 'eve' there could be a space or nothing
after 'eve' there could be symbols or nothing
below code finds ['eve?', 'eve ']
but fails to find the last eve
. How should I change the code
import re
your_string = "eve? is a rule, but not evening and not never. eve eve"
re.findall(r'\beve[^a-zA-Z\d:]', your_string)
I tried below code
where i am trying to code that after 'eve' there could be either \b
or [^a-zA-Z\d:]
but it didnt work
import re
your_string = "eve? is a rule, but not evening and not never. eve eve"
re.findall(r'\beve(\b|[^a-zA-Z\d:])', your_string)