I’m struggling to come up with a RegEx will confirm that some text exists between two tags. Specifically, I want to ensure that that the text "TOTAL" and "$19.00" can be found within the same table row.
I’m not planing to nest tables, so I’m not worried about a nested match, but I do want to make sure that my text is within the SAME tr
My HTML:
<tr style='text-align:right;'>
<td>shipping:</td>
<td style='padding-left:3em;'>$17.00</td>
</tr>
<tr style='text-align:right;'>
<td>TOTAL:</td>
<td style='padding-left:3em;'>$19.00</td>
</tr>
Regular Expression I tried:
/<tr\b[^>]*>(.*?)<\/tr>/m
It’s close, the second capture group has my content. What do I need to change so only the second capture group is matched?
You can play with it on Rubular here
1 Answer