If you use /^(?:"([^"]+)"|(-))$/, the matching expression is not always in the same variable, but it is always in $1 || $2 :)Eh, no. Consider:
Then $1 || $2 is actually undefined (because $1 is 0, hence false, and $2 is undefined). If the OP uses 5.10 or later, he could use $1 // $2, but then there's a better solution available as well (see my other post)."0" =~ /^(?:"([^"]+)"|(-))$/;
In reply to Re^2: Regex: Matching quoted text
by JavaFan
in thread Regex: Matching quoted text
by cmm7825
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |