in reply to Split on whitespace or other criteria
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+|(?=-)/
|
|---|