I want to write a regex equivalent to the following Javascript regexp:
/^(\(\))?$/
to match "()" and ""
I cannot find an equivalent representation in Lua. The problem was that I could make a few characters followed by "?".
For instance,
^%(%)$ can be used to match "()"
^%(%)?$ can be used to match "(" and "()"
but ^(%(%))?$does not work.
source
share