1
0
mirror of https://github.com/inofix/common-playbooks.git synced 2026-02-05 12:45:29 +01:00

Regexp jinja filter

Add a custom filter for very basic regexp substitution.
This commit is contained in:
Michael Lustenberger
2017-07-25 16:23:47 +02:00
parent e4279c0eec
commit 4e375b9927

17
filter_plugins/re_sub.py Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env python
# A quick and dirty regexp replacement filter
import re
def re_sub(s, p, r):
return re.sub(p, r, s)
class FilterModule(object):
'''
custom jinja2 filter for regexp substitution
'''
def filters(self):
return {
're_sub': re_sub
}