diff options
| author | Andrew Leech | 2020-09-25 12:27:02 +1000 |
|---|---|---|
| committer | Damien George | 2020-09-30 23:18:34 +1000 |
| commit | 319437d4bd7c97ab18275d3eaf1bc190554f9df7 (patch) | |
| tree | 93d6cf174d3286cbabb2266698887a621b156f26 /tests | |
| parent | 0fd0eb00aa5b9d311046d48d73a8cfabb30d7dd6 (diff) | |
extmod/modure: Allow \\ in re.sub replacements.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/extmod/ure_sub.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/extmod/ure_sub.py b/tests/extmod/ure_sub.py index 953e7bf62..ae6ad28d6 100644 --- a/tests/extmod/ure_sub.py +++ b/tests/extmod/ure_sub.py @@ -43,6 +43,9 @@ print( ) ) +# \g immediately followed by another \g +print(re.sub("(abc)", r"\g<1>\g<1>", "abc")) + # no matches at all print(re.sub("a", "b", "c")) @@ -69,3 +72,6 @@ try: re.sub(123, "a", "a") except TypeError: print("TypeError") + +# Include \ in the sub replacement +print(re.sub("b", "\\\\b", "abc")) |
