Skip to content

Instantly share code, notes, and snippets.

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 chindraba-work/061826125b89e0be593e465f6f76ef8a to your computer and use it in GitHub Desktop.
Save chindraba-work/061826125b89e0be593e465f6f76ef8a to your computer and use it in GitHub Desktop.
Regular expression to remove comments marked with a double slash - one-line version
^((?:(?:(?:[^"'/\n]|/(?!/))*)(?("(?=(?:\\\\|\\"|[^"])*"))(?:"(?:\\\\|\\"|[^"])*")|(?('(?=(?:\\\\|\\'|[^'])*'))(?:'(?:\\\\|\\'|[^'])*')|(?(/)|.))))*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment