Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use duplicate named capture groups in the future #10

Open
tommy-mitchell opened this issue Aug 3, 2023 · 0 comments
Open

Use duplicate named capture groups in the future #10

tommy-mitchell opened this issue Aug 3, 2023 · 0 comments

Comments

@tommy-mitchell
Copy link
Owner

https://github.com/tc39/proposal-duplicate-named-capturing-groups is stage 3 currently. When it lands in TypeScript / Node.js, it can be used in applyEnvironmentVariables to combine <quoted> and <value>:

* 1. /(?=[^,])/ // Skip commas
* 2. /(?<env>[^:,]*)/ // Capture environment variable name (anything before : or ,)
* 3. /(?: ... | ... )?/ // Search for variable value, 0-1 times
* 4. /:["'](?<quoted>[^"']*)["']/ // First alternate: capture quoted value (after :, between "" or '')
* 5. /:(?<value>[^,]*)/ // Second alternate: capture unquoted value (after :, anything before ,)
*/
const environmentVariableRegex = /(?=[^,])(?<env>[^:,]*)(?::["'](?<quoted>[^"']*)["']|:(?<value>[^,]*))?/g;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant