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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -