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

Fix incorrect regular expression to permit hyphenated-subdomains #205

Merged
merged 1 commit into from
Aug 20, 2020

Conversation

kadamwhite
Copy link
Contributor

The hyphen in .-_ is not treated as a literal hyphen unless it occurs at the end of the [] group. This can be demonstrated in the JS console:

'hyphenated-site'.match( /^[a-z.-_]+$/ ) // null
'hyphenated-site'.match( /^[a-z._-]+$/ ) // [ ...results ]

Reordering these characters allows hyphenated-subdomains to be matched.

The hyphen in .-_ is not treated as a literal hyphen unless it occurs
at the end of the [] group. This can be demonstrated in the JS console:

'hyphenated-site'.match( /^[a-z.-_]+$/ ) // null
'hyphenated-site'.match( /^[a-z._-]+$/ ) // [ ...results ]

Reordering these characters allows hyphenated-subdomains to be matched.
kadamwhite added a commit to humanmade/local-vip that referenced this pull request Aug 20, 2020
Copy link
Member

@rmccue rmccue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking escaping via \ would be better, but seems like there may be a YAML issue with that, so yolo

Copy link
Contributor

@nathanielks nathanielks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍 🙂

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

Successfully merging this pull request may close these issues.

3 participants