Php regex - remove anything between $ and line break but leave the break -
Php regex - remove anything between $ and line break but leave the break -
okay, have php loop generates string this:
$string = "1st fee - $500.00<br> 2nd fee - $500.00<br> 3rd fee - $750.00<br>" i'd remove dollar amount i'm not sure it's possible. i've been trying utilize preg_replace remove between $ , < including $ not < this:
$string = "1st fee - <br> 2nd fee - <br> 3rd fee - <br>" unfortunately me, have leave - because there multiple instances of - on single line so:
$string = "1st fee - brian - $500.00<br> 2nd fee - john - $500.00<br> 3rd fee - bob - $750.00<br>" any help appreciated, if it's telling me give up, not possible. in advance!
so want match everyhing - $ until first left arrow in <br>. first part of pattern - \\$ (need escape $ since regex keyword) match origin part of want removed, , [^<]* take until finds left arrow.
$string = "1st fee - brian - $500.00<br> 2nd fee - john - $500.00<br> 3rd fee - bob - $750.00<br>"; $replaced = preg_replace("# - \\$[^<]*#", "", $string); output:
string '1st fee - brian<br> 2nd fee - john<br> 3rd fee - bob<br>' php regex preg-replace
Comments
Post a Comment