Skip to content

Instantly share code, notes, and snippets.

@HunterKohler
Last active June 20, 2021 16:40
Show Gist options
  • Save HunterKohler/b19c70371ee7c8d60338a6437fb0800b to your computer and use it in GitHub Desktop.
Save HunterKohler/b19c70371ee7c8d60338a6437fb0800b to your computer and use it in GitHub Desktop.
Environment File Key-Value Pair Regex
^([A-Za-z_][A-Za-z0-9_]*)=(?:([^\s'"#]\S*)|(['"])((?:(?!\3)(?:.|\n)|(?<!\\)(?:\\\\)*\\\3)*)\3|())\s*?(?:#.*)?$
@HunterKohler
Copy link
Author

The visual is probably wrong. Regexper doesn't support negative look-behinds, so I had to use a different site with a pythonic interpreter.

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