diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-03-20 14:00:17 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-03-20 14:00:17 -0400 |
commit | 4cad662b69be9fa62460a342e2fd1aa87a7bd548 (patch) | |
tree | 0ccf795feb89790a1e760478c8f3be232383d0ce | |
parent | eb4e2cf91eee89a62c68de0e5332bf63a4cc0166 (diff) | |
download | b4-4cad662b69be9fa62460a342e2fd1aa87a7bd548.tar.gz |
Improve brackets-within-brackets regex
The horrible things people do to their patch subjects continue to amaze
me.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index ae7e452..7b9d2cf 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -867,8 +867,8 @@ class LoreSubject: # Remove any brackets inside brackets while True: oldsubj = subject - subject = re.sub(r'^\s*\[([^\]]*)\[([^\]]*)\]', '[\\1\\2]', subject) - subject = re.sub(r'^\s*\[([^\]]*)\]([^\]]*)\]', '[\\1\\2]', subject) + subject = re.sub(r'^\s*\[([^\]]*)\[([^\[\]]*)\]', '[\\1\\2]', subject) + subject = re.sub(r'^\s*\[([^\]]*)\]([^\[\]]*)\]', '[\\1\\2]', subject) if oldsubj == subject: break |