I'm trying to use replace
module from Ansible, and I don't know how to match some string using regexp
.
I'm trying to match a string starting with the character $
but ansible keeps saying that he found unknown escape character '$'
.
I know that ansible use the same regexp rules from python, but I can't do it in python as well, do you guys know how to do it?
I have tried already these regexp rules:
^\$
, [!^$]
, [!^$]
and \s*[!^$]
The last 3 rules matches with strings starting with $
but if the string doesn't start with $
, matches with those srings too.
some examples for the last 3 rules:
foo doesn't match
$foo match
$$$$ match
foo$ match
foo$bar match
I need to match only in this cases:
foo
$foo this case
$$$$ this case
foo$
foo$bar