diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-10-25 18:35:43 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-10-28 16:59:02 +0200 |
commit | 0befab300849be7ac0f77bc4228f8de50a108191 (patch) | |
tree | ec68cffd95238b814d879621db191ee78c07b8fc /tests | |
parent | 8f892e075668c1ed1d668c59d4d0a7929d0c7f5e (diff) |
Make regex_replace_search() not to match empty substrings in non-empty strings
Diffstat (limited to 'tests')
-rw-r--r-- | tests/regex/testscript | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/regex/testscript b/tests/regex/testscript index 93ad4b6..137469d 100644 --- a/tests/regex/testscript +++ b/tests/regex/testscript @@ -63,6 +63,21 @@ : $* xay '/a/\lVZ/' >xvZy } + + : empty-substring + : + : Note that the regex search-based replacement with the match_not_null flag + : is broken for older versions of libstdc++ and libc++ (may ignore + : match_not_null for the former and may hang for some string/pattern for the + : latter). + : + if (($cxx.id != 'gcc' || $cxx.version.major >= 7) && \ + ($cxx.id != 'clang' || $cxx.version.major >= 6)) + { + $* '' '/.*/x/' >'x' : empty + $* a '/a*/x/' >'x' : match + $* aa '/b*/x/' == 1 : no-match + } } : replace-match @@ -72,6 +87,14 @@ $* abc '/a(b)c/x\1y/' >xby : match $* abcd '/a(b)c/x\1yd/' == 1 : no-match + + : empty-substring + : + { + $* '' '/.*/x/' >'x' : empty + $* a '/a*/x/' >'x' : match + $* ab '/a(c*)(b)/\1\2/' >'b' : match-mid + } } : invalid-regex-fmt |