Skip to content

Fails to parse regex starting with space #3410

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

Closed
Ricket opened this issue Mar 14, 2014 · 3 comments
Closed

Fails to parse regex starting with space #3410

Ricket opened this issue Mar 14, 2014 · 3 comments
Labels

Comments

@Ricket
Copy link

Ricket commented Mar 14, 2014

Regression of #607

See that ticket. There was a test written, but it looks like it got scrapped at some point. The following test fails to compile, for example, despite the parentheses:

ok ' '.match(/ /)[0] is ' '

Currently a workaround is to use /[ ]/ but is it possible to fix this (again) to allow a regex beginning with a space?

@jashkenas
Copy link
Owner

but it looks like it got scrapped at some point

I bet there was a reason for that. Mind searching through the tickets, and looking it up?

@xixixao
Copy link
Contributor

xixixao commented Mar 15, 2014

I'd vote for being consistent rather than clever in this case. The code is pretty clear on it, though I haven't searched for the originating issue.

@elclanrs
Copy link

This fails too, it is the space the problem then, I though it was the arrow.

regex = / -> /
regex.test ' -> '

michaelficarra added a commit that referenced this issue Jan 10, 2015
Fix #3410, #3182: Allow regex to start with space or =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants