[Solved] PHP regex to catch currency and number together [closed]


try this.u will get the result as an array

<?php

$str="usd5 for potatoes";

preg_match('/(?P<name>\w+)(?P<digit>\d+)/', $str, $matches);

print_r($matches);

?>

u will get currency from $matches[‘name’] and value from $matches[‘digit’]

4

solved PHP regex to catch currency and number together [closed]