We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Tutorials
  3. 10 Days of Javascript
  4. Day 7: Regular Expressions III

Day 7: Regular Expressions III

Problem
Submissions
Leaderboard
Discussions
Editorial
Topics
  1. Prepare
  2. Tutorials
  3. 10 Days of Javascript
  4. Day 7: Regular Expressions III
Exit Full Screen View
  • Problem
  • Submissions
  • Leaderboard
  • Discussions
  • Editorial
  • Topics

Task

Complete the function in the editor below by returning a RegExp object, , that matches every integer in some string .

Constraints

  • The length of string is .
  • It's guaranteed that string contains at least one integer.

Output Format

The function must return a RegExp object that matches every integer in some string .

Sample Input 0

102, 1948948 and 1.3 and 4.5

Sample Output 0

102
1948948
1
3
4
5

Explanation 0

When we call match on string and pass the correct RegExp as our argument, it returns the following array of results: [ '102', '1948948', '1', '3', '4', '5' ].

Sample Input 1

1 2 3

Sample Output 1

1
2
3

Explanation 1

When we call match on string and pass the correct RegExp as our argument, it returns the following array of results: [ '1', '2', '3' ].

  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy