regex_escape: support POSIX basic regex (#50327)

This commit is contained in:
James Cassell 2019-03-07 08:51:19 -05:00 committed by Sam Doran
parent 874fd70d10
commit e55e8fe2c4
3 changed files with 31 additions and 3 deletions

View file

@ -1075,11 +1075,18 @@ To replace text in a string with regex, use the "regex_replace" filter::
.. versionadded:: 2.0
To escape special characters within a regex, use the "regex_escape" filter::
To escape special characters within a standard python regex, use the "regex_escape" filter (using the default re_type='python' option)::
# convert '^f.*o(.*)$' to '\^f\.\*o\(\.\*\)\$'
{{ '^f.*o(.*)$' | regex_escape() }}
.. versionadded:: 2.8
To escape special characters within a POSIX basic regex, use the "regex_escape" filter with the re_type='posix_basic' option::
# convert '^f.*o(.*)$' to '\^f\.\*o(\.\*)\$'
{{ '^f.*o(.*)$' | regex_escape('posix_basic') }}
Kubernetes Filters
``````````````````