[PHP] Re: Extracting Numbers from a string.

2002-09-11 Thread M1tch
it doesn't use ereg, but it (should) would work: $mystring = I have $56.55 dollars, don't you know; $mystring = substr($mystring, strpos($mystring, $));//strip out after the $ sign $mystring = substr($mystring, 0, strpos($mystring, ));//keep only till first space //mystring now

Re: [PHP] Re: Extracting Numbers from a string.

2002-09-11 Thread Brad Bonkoski
Of course they may not always know that the user would insert a '$' or a '.' which is what you are keying off of. I am not all that familiar with ereg* functions, I might attack it with stepping through charater by charater and is is_numeric($c) returns true, place it applend it to another