Created
May 17, 2016 09:02
-
-
Save dochang/6125f855c4f52e75f62243a71d414730 to your computer and use it in GitHub Desktop.
A backported filter plugin for Ansible 1.9.x. Put it into `filter_plugins`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def regex_escape(string): | |
'''Escape all regular expressions special characters from STRING.''' | |
return re.escape(string) | |
class FilterModule(object): | |
'''Backported Ansible 2 filters for Ansible 1.9.x''' | |
def filters(self): | |
return { | |
'regex_escape': regex_escape, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment