I have written simple code in Python to match the string using pattern object:
import re
my_pattern = re.compile(r'a\\b')
my_string = 'a\\b'
if my_pattern.match(my_string):
print("Pattern matches the string")
This code indeed print the specified text, but I do not know why. I passed to re.compile()
a raw string with double backslash, while matched string contains only one so it shouldn't be matched. I thought that such pattern object would match the string only if it contains an and b separated by double backslash.