0

I need help on regex in split() method.

Here is what I have so far :

modelName.trim().split("\\s+");

Unfortunately, if I have a string such as this :

(Blue Yellow) Red Green

It would end up like this :

  1. (Blue
  2. Yellow)
  3. Red
  4. Green

How do I write a regex to get this result :

  1. (Blue Yellow)
  2. Red
  3. Green
mrQWERTY
  • 4,039
  • 13
  • 43
  • 91

0 Answers0