This is written in Python,
import re
s='1 89059809102/30589533 IronMan 30 Santa Ana Massage table / IronMan 30 Santa Ana Massage table'
pattern='\s(\d{11})/(\d{8})'
re.match(pattern,s)
it returns none.
I tried taking the brackets off,
pattern='\s\d{11}/\d{8}'
It still returns none.
My questions are:
- Why the re.match does not find anything?
- What is the difference with or without bracket in pattern?
\sand\dhave no meaning in normal python strings, so in this specific case there is no difference and the backslashes do not require escaping. - Martijn Pieters♦\followed by a character that does not form an escape sequence. - nhahtdhr''raw strings for regular expressions is certainly a great idea and is the best practice. Just in this case the OP is lucky and there is no difference. :-) - Martijn Pieters♦\one-character escape sequences follow the ISO C standard though (see the third column on the control codes table), so generally speaking you can assume there are at most 9 such escape codes in any language that supports these. In fact, I know of no programming language that supports such escape codes and support more than those 9 (python itself supports 8 of them,\enot seen as often). - Martijn Pieters♦\bhas a meaning as both a character escape (backspace) and as a regular expression anchor (beginning of a word boundary). :-) - Martijn Pieters♦