I need a regular expression that will find all the numbers on a sentence.
For example:
“I have 3 bananas and 37 balloons”
I will get:
3
37
“The time is 20:00 and I have 7 tanks”
I will get:
20
00
7
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The regex itself is as simple as
\d+, but you will also need to set a flag to match it globally, the syntax of which depends on the programming language or software you are using.EDIT: Some examples:
Python:
JavaScript: