Skip to content

Fix badmatch with Regex.captures(%r/(.)/g, "cat")#1041

Merged
josevalim merged 1 commit intoelixir-lang:masterfrom
pragdave:fix-regex-run
May 9, 2013
Merged

Fix badmatch with Regex.captures(%r/(.)/g, "cat")#1041
josevalim merged 1 commit intoelixir-lang:masterfrom
pragdave:fix-regex-run

Conversation

@pragdave
Copy link
Contributor

@pragdave pragdave commented May 9, 2013

The above caused a badmatch because Regex.run didn't handle a return from re:run of just :match.

:match is returned if a pattern has /g but no captures are made. My fix was to have .run return [] in this case. The tests pass, but I'm a little nervous about compatibility in the field.

Dave

josevalim pushed a commit that referenced this pull request May 9, 2013
Fix badmatch with Regex.captures(%r/(.)/g, "cat")
@josevalim josevalim merged commit 03a11b4 into elixir-lang:master May 9, 2013
@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants