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:
17
filter_plugins/re_sub.py
Normal file
17
filter_plugins/re_sub.py
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user