Regular expression: Is this a mistake or not? #16320
-
Deletion does not occur. On "big" python it works.
(MicroPython v1.23.0-220.g6927639898 on 2024-07-11; LOLIN_S2_MINI with ESP32-S2FN4R2) |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Yes same thing on micropython 1.23 stable... |
Beta Was this translation helpful? Give feedback.
-
Yes, so too
Unfortunately, this is an artificial situation. |
Beta Was this translation helpful? Give feedback.
-
It stops at the NULL byte. Example:
|
Beta Was this translation helpful? Give feedback.
-
MicroPython's re module is very limited. Remember the Micro- part of MicroPython. It doesn't have to do everything that unskimmed Python does. First off, MicroPython regular expressions can't handle any escape sequences outside the short list given in the documentation. The list doesn't include re.sub(chr(0), "", chr(0)+"\x01") Secondly, don't use |
Beta Was this translation helpful? Give feedback.
\x00
is the string terminator in ›C‹Wouldn't be surprised if the internal handling isn't quite right.