Skip to content

Instantly share code, notes, and snippets.

@Nixinova
Last active July 10, 2021 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nixinova/b6959351d57e67335657908440e3f777 to your computer and use it in GitHub Desktop.
Save Nixinova/b6959351d57e67335657908440e3f777 to your computer and use it in GitHub Desktop.
Convert regex free-spacing mode (`(?x)`) to normal regex
function flatten(str) {
return str.replace(/\r?\n|^\s+|\s+#\s.+$/gm, '').replace('(?x)', '')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment