Regex

Extract Numbers

easyregexregexparsing
0:00

Problem

Given a string, return an array of all integers found (as numbers). Preserve order of appearance.

Your solution
Test results
Click Run tests to check your solution against the test cases.

About this challenge

Extract Numbers is a easy regex coding challenge. It tests your command of regular expressions — pattern-matching that trips up even experienced developers. Write your solution in the editor above, run it against the test cases, and get instant feedback — free, in your browser, no sign-up.

Show a hint & approach (spoiler)

Hint: Use `s.match(/\d+/g)` and map the result with Number.

Keep practicing

Browse all coding challenges, or build intuition for the underlying concepts with the algorithm visualizers and the developer cheatsheets.