Skip to content

Instantly share code, notes, and snippets.

@ardianta
Last active August 28, 2020 08:41
Show Gist options
  • Save ardianta/5fd6a8ae277ad58a0a758b0d9546ecf5 to your computer and use it in GitHub Desktop.
Save ardianta/5fd6a8ae277ad58a0a758b0d9546ecf5 to your computer and use it in GitHub Desktop.
VS Code Find and Replace using Regex

I want to find this string:

{{< img "/img/image-name.png" "Image Caption" >}}

And replace with:

![Image Caption](/img/image-name.png)

So the regex for finding:

(\{\{<) (img) "(.*?)" "(.*?)" (>\}\})

And the regex for replacing:

![$4]($3)
  • $4 -- will take the 4th group
  • $3 -- will take the 3rd group

VS Code Find and Replace

Demo: https://regex101.com/r/eusVXZ/2/

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