I've looked all over the place, but I can't seem to only return the first positive, real number. So far, I have successfully found how to find the first positive or negative number and also only find the first negative number. Below are the two I did correctly and the one I can't get.
$str1 = "-ABS-.-179.3333es-k15dk825.44f";
1) Find first real number in string:
preg_match("/-?((\.\d+)|(\d+(\.\d+)?))/", $str1, $matches) // <- GOOD!
Expected output: -179.3333
Actual output: -179.3333
2) Find first, negative real number in string:
preg_match("/-((\.\d+)|(\d+(\.\d+)?))/", $str1, $matches) // <- GOOD!
Expected output: -179.3333
Actual output: -179.3333
3) Find first, positive real number in string:
preg_match("/(?<!-)((\.\d+)|(\d+(\.\d+)?))/", $str1, $matches) //<- WRONG!
Expected output: 15
Actual output: 79.3333
Any help is greatly appreciated!