First, you match the currency, which can be either $ or EUR , and then the extra empty space:
(?:EUR|[$])\s*
Then map the main group of numbers, followed by an optional period and two numbers:
\d+(?:\.\d{2})?
In general, we get the following:
$pattern = '/(?:EUR|[$])\s*\d+(?:\.\d{2})?/'; if (preg_match($pattern, $string, $matches)) { echo $matches[0]; }
Ja͢ck source share