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

Add regex to allow leading $ and _ #2418

Merged
merged 2 commits into from Feb 20, 2015
Merged

Add regex to allow leading $ and _ #2418

merged 2 commits into from Feb 20, 2015

Conversation

ckross01
Copy link
Contributor

Fixes #2401
added to the regex to allow leading $ and _
added two tests to validate that the leading $ _ is allowed for a method name

@@ -35,7 +35,7 @@ internals.Methods.prototype.add = function (name, method, options, realm) {
};


exports.methodNameRx = /^[a-zA-Z]\w*(?:\.[a-zA-Z]\w*)*$/;
exports.methodNameRx = /^[_$a-zA-Z]\w*(?:\.[a-zA-Z]\w*)*$/;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably worth adding that to the other text block so you can do _a._b

per suggestion added the second half of the regex to allow _ and $ as well.
@hueniverse hueniverse added the bug Bug or defect label Feb 20, 2015
@hueniverse hueniverse added this to the 8.3.0 milestone Feb 20, 2015
@hueniverse hueniverse self-assigned this Feb 20, 2015
hueniverse pushed a commit that referenced this pull request Feb 20, 2015
Add regex to allow leading $ and _
@hueniverse hueniverse merged commit d283f45 into hapijs:master Feb 20, 2015
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Method name RegExp
2 participants