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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -