strings.bif/sub,gsub: Respect anchors in pattern

Anchors within pattern passed to sub() or gsub() were previously ignored,
replacing any occurrence of '<text>' even when '^<text>' was used as a
pattern.

This is a pretty user-visible change (and we even have anchored patterns
within the base scripts), but seems "the right thing to do".

Relates to #3455
This commit is contained in:
Arne Welzel 2023-11-17 13:33:22 +01:00
parent d9b8154c4e
commit e339e93e69
5 changed files with 76 additions and 1 deletions

4
NEWS
View file

@ -23,6 +23,10 @@ Changed Functionality
end-of-line $ anchors. Previously, an anchored pattern would be matched anywhere
in the input string.
- The ``sub()`` and ``gsub()` functions now respect the beginning-of-line ^ and
end-of-line $ anchors. Previously, an anchored pattern would be matched anywhere
in the input string.
Removed Functionality
---------------------