We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
tarantool> string.gsub('\x00abc', '[%z\x01-\xff]', 'x') --- - xxxx - 4 ... -- Expected "xxxx". tarantool> string.gsub('\x00abc', '[\x00-\xff]', 'x') --- - error: malformed pattern (missing ']') ... -- Expected "axxxd". tarantool> string.gsub('ab\x00cd', 'b\x00c', 'xxx') --- - "axxx\0cd" - 1 ...
Other functions that accept a pattern look affected by the problem too, at least string.find() is affected.
string.find()
The text was updated successfully, but these errors were encountered:
Hi, Alexander!
As you can see from Lua 5.1 Reference Manual for string.find()
This function does not accept string values containing embedded zeros, except as arguments to the q option.
q
PUC RIO Lua accept embedded zeros in patterns since Lua 5.2. So, we can implement this feature within full Lua 5.2 compatibility, if we want.
Also, see the same ticket in LuaJIT repo: LuaJIT/LuaJIT#759.
Sorry, something went wrong.
So, we can implement this feature within full Lua 5.2 compatibility, if we want.
We can implement it within partial Lua 5.2 compatibility as well, because the change is compatible.
As you can see from Lua 5.1 Reference Manual for string.find() This function does not accept string values containing embedded zeros, except as arguments to the q option.
The quote is about string.format(). However you're right, the manual says the same for patterns:
string.format()
A pattern cannot contain embedded zeros. Use %z instead.
So, technically speaking, this is not a bug. It is a feature request.
No branches or pull requests
Other functions that accept a pattern look affected by the problem too, at least
string.find()
is affected.The text was updated successfully, but these errors were encountered: