mirror of
https://github.com/micropython/micropython.git
synced 2026-01-08 21:20:13 +01:00
extmod/modure: Set subject begin_line so ^ doesn't match interior.
Fixes issue #8402. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -31,3 +31,13 @@ print(s)
|
||||
r = re.compile(b"x")
|
||||
s = r.split(b"fooxbar")
|
||||
print(s)
|
||||
|
||||
# using ^
|
||||
r = re.compile("^ab")
|
||||
s = r.split("abababcabab")
|
||||
print(s)
|
||||
|
||||
# using ^ with |
|
||||
r = re.compile("^ab|cab")
|
||||
s = r.split("abababcabab")
|
||||
print(s)
|
||||
|
||||
@@ -75,3 +75,7 @@ except TypeError:
|
||||
|
||||
# Include \ in the sub replacement
|
||||
print(re.sub("b", "\\\\b", "abc"))
|
||||
|
||||
# Using ^, make sure it doesn't repeatedly match
|
||||
print(re.sub("^ab", "*", "abababcabab"))
|
||||
print(re.sub("^ab|cab", "*", "abababcabab"))
|
||||
|
||||
Reference in New Issue
Block a user