This works (somewhat surprisingly) even in the case where there is a space before the minus. That is because split will not split a string in the same place twice (to avoid infinitely returning empty fields).split /\s+|(?=-)/
In reply to Re: Split on whitespace or other criteria
by Roy Johnson
in thread Split on whitespace or other criteria
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |