<?php $re = '/\[[^][\d]*\K\d+(?:\.\d+)?(?=[^][]*])/'; $str = 'I have the following expression [+₪7.00], I wish to extract only 7.00 or 7.'; if (preg_match_all($re, $str, $matches)) { print_r($matches[0]); }
You have javascript disabled. You will not be able to edit any code.