The wrong regular expression was written
1. Number of back bands
It’s embarrassing to write “d” as “B”
>>> pattern = re.compile(r'123\b*hello')
Output:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "E:\Anacoda3\Lib\re.py", line 233, in compile
return _compile(pattern, flags)
File "E:\Anacoda3\Lib\re.py", line 301, in _compile
p = sre_compile.compile(pattern, flags)
File "E:\Anacoda3\Lib\sre_compile.py", line 562, in compile
p = sre_parse.parse(p, flags)
File "E:\Anacoda3\Lib\sre_parse.py", line 856, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, False)
File "E:\Anacoda3\Lib\sre_parse.py", line 415, in _parse_sub
itemsappend(_parse(source, state, verbose))
File "E:\Anacoda3\Lib\sre_parse.py", line 615, in _parse
source.tell() - here + len(this))
sre_constants.error: nothing to repeat at position 2
Error reason: because the word boundary is the word boundary, the meaning of * is the occurrence of any times, that is to say, the word can only have one boundary, and can not occur any times, so this error will be reported
Similar Posts:
- [LeetCode] 291. Word Pattern II
- How to Solve Error: Unexpected token o in JSON at position 1
- Pychar report Python package tools not found error
- MySQL Python error installed in pyenv 2.7 environment
- Unexpected token ‘ in JSON at position 2 at JSON.parse
- Command line tool for handling JSON under Linux: JQ — installation
- Bootstrap switch Uncaught TypeError: Cannot read property ‘apply’ of undefined
- Cmake solves the problem of phread Library in C + + 11: undefined reference to ` pthread_ create’