Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of regex used in import-js before moving to babylon
(?<declaration_keyword>const|let|var)\s+ # <declaration_keyword>
(?<assignment>.+?) # <assignment> variable assignment
(?<import_function>\w+?)\( # <import_function> variable assignment
(?<quote>'|") # <quote> opening quote
(?<path>[^\2\n]+) # <path> module path
\k<quote> # closing quote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment