I need the str_replace
line of code below to match only when inside a <td></td>
where there will be other random stuff, too (so maybe wildcards are needed?). I assume there's some regex involved but I couldn't make it work. The code works, but I just want it to work in my tables vs. the entire page.
For reference, the larger snippet that includes this code breaks long product specs into two lines at the hyphen instead of weird places when word-wrap naturally occurs in the table.
Eg: (16 x 20 x 18 (406 x 508 x 457) - 24 x 36 x 18 (711 x 914 x 457)
$html = str_replace( ') - ', ') - <br />', $html );
It would be nice if it also worked even if the person entering all of our data doesn't use spaces around the hyphens for whatever reason or maybe accidentally does on one side or the other. I think there will always be parenthesis.
Thanks!