Example 'find what' regex: url\(['"]*(?<url>[^<%|^'<%|^"<%].*?[^'"])['"]*\)
Example 'replace with' regex: url("<%= asset_path '$+{url}' %>")
I used this regex to find url('path/my_image_file.png')
and convert it to url("<%= asset_path 'path/my_image_file.png' %>")
.
Tips:
(?<named>expression)
is a named subexpression, and it can be accessed on the 'replace with' field using: $+{named}
.
Sublime uses the Perl REGEX engine.
You can find more information here: http://www.boost.org/doc/libs/1_44_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html and here: http://www.boost.org/doc/libs/1_44_0/libs/regex/doc/html/boost_regex/format/perl_format.html