Search code examples
regexangularjstextmate2

regex: how to capture angularjs pattern in source file with textmate2?


I'd like to capture all source file lines matching the following template (actually any img tag where the url contains an angularjs interpolation):

<td><img src="rsc/kws.corn.icon.{{cure}}.png">

I tried this without success:

src="rsc/[^{]*{{[^"]*"

Solution

  • Ok, the quote was missing. Here is the right regex, which I also improved:

    src\s*=\s*"rsc/[^{"]*{{[^"]*"