Skip to content

Instantly share code, notes, and snippets.

@webstandardcss
Created February 8, 2015 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webstandardcss/f4961d5bbb45b28403fd to your computer and use it in GitHub Desktop.
Save webstandardcss/f4961d5bbb45b28403fd to your computer and use it in GitHub Desktop.
Regular expression for parsing old ansible variables with the $ and replacing with jinja2 style double curly brace
Search for:
\$\{?(\w+\.?\_?\w+\.?\_?\w+)\}?
Replace with
{{ \1 }}
@webstandardcss
Copy link
Author

Thanks God and Sublime Text for allowing me to interactively construct this regex and save hours of mindless drudgery replacing $this.stuff and ${that_stuff} with all of {{ this_stuff.here }}. Without your quick feedback this would not have been possible for me to do so quickly.

Oops what about ${ this_there } !

@webstandardcss
Copy link
Author

Insanely complete Ansible playbook, showing off all the options.

https://gist.github.com/webstandardcss/9d1a293914d972399712

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment