Try
re.search(r'is', your_string)
From the docs:
Matches the empty string, but only at the beginning or end of a word.
Note that the re
module uses a naive definition of "word" as a "sequence of alphanumeric or underscore characters", where "alphanumeric" depends on locale or unicode options.
Also note that without the raw string prefix,
is seen as "backspace" instead of regex word boundary.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…