I have a text file that has many correct prices (decimals that start with a dollar sign). But there are a few that don't have a dollar sign. How can I find those?
In the following string, I only like to match. 72.00
$40.00 72.00
$6
I have tried negative lookbehind, like this (?<!\$)\d \.\d
. But this one still matches part of the first decimal.
CodePudding user response:
You can start the match with a word boundary to not trigger the lookbehind on every position when not matching a decimal value:
\b(?<!\$)\d \.\d \b
See a regex101 demo.