Wrong regular expression
1. \b followed by the quantity
Wrongly written \d to \b, embarrassing!
1
|
>>> 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
Reason for error: Since \b is a word boundary, * means that it appears any number of times, that is, a word can only have one boundary, and it cannot appear any number of times, so this error will be reported
Read More:
- Template cannot be rendered due to the joint query of populate in mongoose: syntax error: unexpected token r in JSON at position 0
- vue VM682:1 Uncaught SyntaxError: Unexpected token u in JSON at position 0
- [Solved] Vscode Katex Error: ParseError: KaTeX Parse Error: Can‘t Use Function ‘$‘ In Math Mode At Position …
- [Solved] SyntaxError: Invalid regular expression: invalid group specifier name
- [Solved] Failed loading positionFile: /opt/module/flume/taildir_position.json
- [Solved] error C4996: ‘QWheelEvent::pos‘: Use position()
- [Solved] Kafka2.3.0 Error: Timeout of 60000ms expired before the position for partition could be determined
- [Solved] Access to XMLHttpRequest at ‘http://127.0.0.1:5000/markdownlang/‘ from origin ‘null‘ has been bl
- [Soled] Eslint Error: Unexpected literal in error position of callback
- [Solved] At least one of these environment variable is needed to run this program
- How to Solve QT Error: The build directory needs to be at the same level as the source directory.
- Failed to connect to driver at XXXXXXx
- [Solved] Docker Error: got permission denied while trying to connect to the docker daemon socket at…
- How to Fix ERROR Couldn’t connect to Docker daemon at http+docker://localunixsocket
- [Solved] Uncaught ReferenceError: is not defined at HTMLAnchorElement.onclick
- [Solved] RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and
- Max virtual memory areas vm.max_map_count [65530] is too low, increase to at least
- [Solved] hello.s:15 Error: junk at end of line, first unrecognized character valued 0x8
- [Solved] CMake Error at CMakeLists.txt:92 (add_subdirectory)
- [Vagrant] When vagrant up, it stops at “SSH auth method: private key” and times out.