Skip to content

Instantly share code, notes, and snippets.

@euhmeuh
Created November 17, 2017 10:10
Show Gist options
  • Save euhmeuh/0b7e64a6c79d4bd361f2201383bfbffe to your computer and use it in GitHub Desktop.
Save euhmeuh/0b7e64a6c79d4bd361f2201383bfbffe to your computer and use it in GitHub Desktop.
Regex syntax memo

Name grouping and replacement

Named group is formed with (?<name>).
Captured text can be inserted in result using $+{name}.

Example text: <foo><bar>Hello</bar> <baz>World!</baz></foo>
In the regex: <foo><bar>(?<message>.+)</bar> <baz>(?<object>.+)</baz></foo>
Replace by: <message object="$+{object}">$+{message}</message>

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