Here is a string: (1 AND 2) OR 30 AND (4 AND 5). I need a list of numbers included in this string. Please help me out.
Asked
Active
Viewed 55 times
1 Answers
0
Use match:
var numbers = "(1 AND 2) OR 30 AND (4 AND 5)"
var formatted = numbers.match(/\d+/g)
console.log(formatted); // [1,2,30,4,5]

Jonathan Dion
- 1,651
- 11
- 16
-
-
-
If the answer is good you should accept it to close the question. Thanks. – Jonathan Dion May 07 '17 at 15:17