Jump to content

Extract Grouped Digits from a String?


Gauss
 Share

Recommended Posts

This is probably a silly Question but how can i get the digits extracted from a string and store it in an array of numbers

For example:

$str = 'Mark scored 95 out of 100 in the final test'

Expected Result:95,100

I tried this: $num = StringRegExp($str, '(d+)', 2) but I'm getting the result as 95,95

Can someone please help me quickly?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...