Jump to content

Recommended Posts

Posted

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?

Posted

1 more small question

I sometimes get garbage value between these 2 number $str = 'Mark scored 95 out 08 of 100 in the final test'

How to get the first and the last group of numbers?

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
  • Recently Browsing   0 members

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