...oh, hmm ... you only want to split on - if it has a space on both sides
huh?  does java regex have a "don't be greedy option?" ... javadocs say
yes (they call it "Reluctant" vs "greedy" so try something like this...

   pattern="\s*?(\s-\s|--|,|\(|\))\s*?"


it *almost* works, with:

  (\s{1,}-\s{1,}|^\s*|\s*$|\s*--\s*|\s*\(\s*)

BUT if i add a condition for ')' it falls apart... this one *almost* works too:
  (\s*(\s{1,}-\s{1,}|--|,|\(|\))\s*?|^\s*|\s*$)


After 1/2 hour of regex hacking... I think I'll stick with a two step process: split then trim ;)


Reply via email to