So you ran the code, saw that it works, but didn't know why.
I would suggest perldoc perlre or perhaps The Owl Book. It works because I have anchored it at both ends ^ and $ and forced the other spaces where appropriate. Since general use of .* is frowned upon, I have modified it after reading your more constraining information here.
Cheers - L~R
In reply to Re^3: can't use unpack or split??
by Limbic~Region
in thread can't use unpack or split??
by seaver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |