I was reading in regexes documemtation about "Tilde for nesting structures".
The sideline explanation about the use of <?>
is:
Here
<?>
successfully matches the null string.
I assumed that I was able to use <?[]>
instead of it, but it failed to do so!
As an example:
say so "" ~~ / <?> /;
say so "test" ~~ / <?> /;
say so "" ~~ / <?[]> /;
say so "test" ~~ / <?[]> /;
The response:
True
True
False
False
Could someone give me an explanation about this?