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
Post a Comment