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 patterns for variables like "$x1" #43

Merged
merged 2 commits into from Apr 12, 2019
Merged

Fix patterns for variables like "$x1" #43

merged 2 commits into from Apr 12, 2019

Conversation

xi
Copy link
Contributor

@xi xi commented Apr 11, 2019

Take for example the variable pattern: ^[_]?[a-z]+([a-z0-9-]+[a-z0-9]+)?$.

  • If ([a-z0-9-]+[a-z0-9]+)? is not matched it allows an arbitrary number of lowercase alphabetic character with an optional underscore at the beginning.
  • If ([a-z0-9-]+[a-z0-9]+)? is matched it does also allow numerics and dashes after that (but no dash at the end). But it will only match if there are at least two of these characters.

I assume this last bit is unintentional, as it prohibits variable names such as $x1 while allowing $x, $xs, and $x10. Apart from fixing that, I also removed some dispensable + as I think that makes the patterns easier to understand.

Copy link
Owner

@bjankord bjankord 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, thanks for the PR @xi

@bjankord bjankord merged commit ab57b4e into bjankord:master Apr 12, 2019
@bjankord
Copy link
Owner

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.

None yet

2 participants