use a character class to split the values:
/(-?[\d.]+)/
-?
May start with a negative such as-123
[\d.]+
Has one or more numbers and decimals
var string = "stuff 1.23! (456) 789 stuff -234".split(/(-?[\d.]+)/);
console.log(string)
More Related Contents:
- consider a string which has question marks, numbers , letters [closed]
- Split array into chunks
- How do I split a string with multiple separators in JavaScript?
- How can I parse a CSV string with JavaScript, which contains comma in data?
- Split large string in n-size chunks in JavaScript
- How can I split a string into segments of n characters?
- javascript regex split produces too many items
- Javascript split string on space or on quotes to array
- Javascript split regex question
- JavaScript split String with white space
- Split a string based on multiple delimiters
- RegEx to match stuff between parentheses
- javascript split string by space, but ignore space in quotes (notice not to split by the colon too)
- String split returns an array with more elements than expected (empty elements)
- Split by Caps in Javascript
- Javascript: Splitting a string by comma but ignoring commas in quotes
- split an array into two based on a index in javascript
- How do you split a javascript string by spaces and punctuation?
- How can I use Unicode-aware regular expressions in JavaScript?
- How to get distinct values from an array of objects in JavaScript?
- How to sort numbers correctly with Array.sort()? [duplicate]
- Sort Array by ISO 8601 date
- Javascript – convert array of arrays into array of objects with prefilled values
- Get URL from background-image Property
- regex street address match
- Replace function not replacing [duplicate]
- Include Arabic characters in JavaScript regular expression?
- Use RegExp to match a parenthetical number then increment it
- Converting Array of Objects into Array of Arrays
- How to count the number of lines of a string in javascript