Try the following:
if (preg_match('/(?<=\$)\d+(\.\d+)?\b/', $subject, $regs)) {
Explanation:
" (?<= # Assert that the regex below can be matched, with the match ending at this position (positive lookbehind) \$ # Match the character "\$" literally ) \d
FailedDev
source share