javascript - RegEx last space issue -


my regex = /\s+/

i want accomplish digits separated spaces. works, catches last space (since i'm splitting it, last space goes "" array element).

"123 123 213" - works fine.

"21 12 21 421 " - catches last space.

how can fix this?

trim string before run regex , done.


Comments