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

Pattern translator does not escape special characters correctly. #22

Open
paulcuth opened this issue Jul 17, 2014 · 1 comment
Open

Comments

@paulcuth
Copy link
Contributor

The following example highlights differences in output of pattern matching functions between C Lua and Moonshine.

print(string.gsub('ReturnRegionNotification', '\\u.?.?.?.?', 'XXX'))

C Lua returns:

ReturnRegionNotification    0

Moonshine returns:

RetXXXgionNotification  1

I believe there's some escaping of special chars missing from the translated pattern prior to construction of the RegExp object.

@CerfurMark
Copy link

I just ran into the same problem. Here are two examples:

s = "-"
print(string.match(s, "%-"))
output: userdata (should have been "-")

s = "-2"
print(string.match(s, "%-%d"))
output: 2 (should have been "-2")

The pattern matching seems to be having trouble with the minus sign. The %d seems to work ok.

These pattern matches work fine on my regular Lua.

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

No branches or pull requests

2 participants