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

Make empty groups in regex.gmatch return their offset #1325

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

Guldoman
Copy link
Member

This makes regex.gmatch behave like string.gmatch.

This makes `regex.gmatch` behave like `string.gmatch`.
@jgmdev
Copy link
Member

jgmdev commented Jan 13, 2023

Tested with the following sample code to compare:

for value in string.gmatch("test", "te()s") do
  print(value)
end

for value in regex.gmatch("te()s", "test") do
  print(value)
end

And now regex.gmatch returns same result as string.gmatch which in this case is 3

Another small variation, both print te:

for value in string.gmatch("test", "(te)()s") do
  print(value)
end

for value in regex.gmatch("(te)()s", "test") do
  print(value)
end

@Guldoman Guldoman merged commit b89dedf into lite-xl:master Jan 13, 2023
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Jan 16, 2023
This makes `regex.gmatch` behave like `string.gmatch`.
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
This makes `regex.gmatch` behave like `string.gmatch`.
takase1121 pushed a commit to takase1121/lite-xl that referenced this pull request Aug 19, 2023
This makes `regex.gmatch` behave like `string.gmatch`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants