As in the title: in Lua programming language is [^%d%u] equal to [%D%U] in it's buildin regular expressions ?
I would say it is but I suspect that this question is asked in the book
Programming in Lua, Fourth Edition
Roberto Ierusalimschy
Copyright © 2016, 2003 Roberto Ierusalimschy
on the page 89 for a reason. But I can't think about any reason why those would be different.
These are different patterns.
[^%d%u]matches any char other than digit and uppercase letters. So it matches.and_anda, but does not match0andA.[%D%U]matches any chars since it matches any non-digit or any non-uppercase letter.Note that in a negated bracket expression (
[^...]), the relationship between the patterns inside it is AND and in a positive bracket expression ([...]), it is OR.