PCRE Regex in PHP
PHPUse preg_match with named groups to parse structured text.
<?php
declare(strict_types=1);
$text = 'Order #1042 for $99.95';
if (preg_match('/Order #(?<id>\d+) for \$(?<amount>\d+\.\d{2})/', $text, $m)) {
echo "id={$m['id']} amount={$m['amount']}", PHP_EOL;
}