JavaScript Regex split by hyphen and spaces -


i have string in following format: 90000 - 90000 numbers can of variable length, , there space, hyphen, space between them. i'm trying split string 2 numbers regex:

var regex = new regexp('/([0-9])\w+'); 

but array contains 1 element: original string not seem split.

you can use split function:

var s = '90000 - 90000'; var = s.split(/[ -]+/); console.log(a); 

output:

["90000", "90000"] 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -