I would like to parse the HD price from the following snipper of HTML. I am only have fragments of the html code, so I cannot use an HTML parser for this.
You can use this regex:
\d+(?:\.\d+)?(?=\D+HD Version)
\D+ skips ahead of non-digits in a lookahead, effectively asserting that our match (19.99) is the last digit ahead of HD Version.Here is a regex demo.
Use the i modifier in the regex to make the matching case-insensitive and change + to* if the number can be directly before HD Version.