filter to exclude a string pattern ?

21 views
Skip to first unread message

Nicolas G

unread,
Sep 17, 2015, 8:52:04 PM9/17/15
to Ansible Project
Hi, I have the bellow values written from some vars , they all have a pattern 'xyz_' on front :

xyz_name_1
xyz_name_2
xyz_special_3
xyz_other_4


Is there a filter I can use to exclude the 'xyz_' pattern so my values will be more clear like :

name_1
name_2
special_3
other_4


???

Brian Coca

unread,
Oct 23, 2015, 7:29:27 PM10/23/15
to Ansible Project
you can use the replace filter {{var|replace('xyz_','')}}




--
Brian Coca
Reply all
Reply to author
Forward
0 new messages