Example:
def searchResult(expr, inputStr):
if (re.search(expr, inputStr)):
return True
return False
print(searchResult("\s", "the quick brown fox")) # True
print(searchResult("\bfox", "the quick brown fox")) # False
print(searchResult("\\bfox", "the quick brown fox")) # True
I need double backslash "\\b"
for word boundaries, but just single backslash "\s"
is acceptable for whitespace characters. Why is the double backslash required for word boundaries?