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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -