diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2019-11-21 14:19:52 +0100 |
---|---|---|
committer | Radomir Dopieralski <openstack@sheep.art.pl> | 2019-11-21 14:21:50 +0100 |
commit | a6acf8236ce0322b8856f06a9c589d8f40851dc5 (patch) | |
tree | 9c588902cf42585d18ee3a10ffe6721f9dccee65 /oslo_utils | |
parent | ed70bd3cd10eae2a34a5e9bd5d1fe0a6791ab3de (diff) | |
download | oslo-utils-a6acf8236ce0322b8856f06a9c589d8f40851dc5.tar.gz |
Fix invalid escapes in regular expression strings
The "r" for raw strings has to repeated when several strings are
concatenated, otherwise the backslash in the strings that miss
the "r" are interpreted directly, and result in invalid escapes.
Change-Id: I3736a40043c8aa6c36c21803bf68f842af5cd55e
Diffstat (limited to 'oslo_utils')
-rw-r--r-- | oslo_utils/strutils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/oslo_utils/strutils.py b/oslo_utils/strutils.py index 40c45dd..726f2dd 100644 --- a/oslo_utils/strutils.py +++ b/oslo_utils/strutils.py @@ -83,11 +83,11 @@ _FORMAT_PATTERNS_2 = [r'(%(key)s[0-9]*\s*[=]\s*[\"\'])[^\"\']*([\"\'])', r'([-]{2}%(key)s[0-9]*\s+)[^\'^\"^=^\s]+([\s]*)', r'(<%(key)s[0-9]*>)[^<]*(</%(key)s[0-9]*>)', r'([\"\']%(key)s[0-9]*[\"\']\s*:\s*[\"\'])[^\"\']*' - '([\"\'])', + r'([\"\'])', r'([\'"][^"\']*%(key)s[0-9]*[\'"]\s*:\s*u?[\'"])[^\"\']*' - '([\'"])', + r'([\'"])', r'([\'"][^\'"]*%(key)s[0-9]*[\'"]\s*,\s*\'--?[A-z]+' - '\'\s*,\s*u?[\'"])[^\"\']*([\'"])', + r'\'\s*,\s*u?[\'"])[^\"\']*([\'"])', r'(%(key)s[0-9]*\s*--?[A-z]+\s*)\S+(\s*)'] # NOTE(dhellmann): Keep a separate list of patterns by key so we only |