print "$1\n" while $line=~s/(\w+\s+\w+|\w+)[}|\s+|\s+{]//;
Metacharacters like | are not meta-special in a character class, so [}|\s+|\s+{] from the quoted regex is equivalent, with the pipe metacharacter explicitly escaped (for clarity), to [\s{}\|] or, less verbosely, to the [\s{}|] class. (In other words, there's no alternation in a character class.)
In reply to Re^2: Splitting string using two overlapping patterns
by AnomalousMonk
in thread Splitting string using two overlapping patterns
by kpr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |