Answer the question
In order to leave comments, you need to log in
How to find \xNN in a string using python3 regex?
Let's say there is a string '\x3e\x1f\x2c', exactly a string, type str
You need to find \x1f-\x2f in it,
I wrote the expression \\x[1|2]{1}[ in https://pythex.org/ ac|f]{1} and got the result, but python3 doesn't want to process it afterwards.
Answer the question
In order to leave comments, you need to log in
why is there a regex if there is a specific string to be found?
Let's say there is a string '\x3e\x1f\x2c', exactly a string, of type str
in that case there is '\\x3e\\x1f\\x2c'
s = r'\x3e\x1f\x2c\x1f-\x2f\x2c\x3c'
print(s)
if s.find('\\x1f-\\x2f') != -1:
print('совпало')
if '\\x1f-\\x2f' in s:
print('совпало')
re.findall(r'\\x[1|2]{1}[a-c|f]{1}',s)
['\\x1f', '\\x2c', '\\x1f', '\\x2f', '\\x2c']
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question