Okay, I have a php loop that generates a string like this:
$string = "1st fee - $500.00<BR>
2nd fee - $500.00<BR>
3rd fee - $750.00<BR>"
I’d like to remove the dollar amount but I’m not sure it’s even possible. I’ve been trying to use preg_replace to remove everything between $ and < including the $ but not the < to get something like this:
$string = "1st fee - <BR>
2nd fee - <BR>
3rd fee - <BR>"
Unfortunately for me, I have to leave the - because sometimes there will be multiple instances of the - on a single line like so:
$string = "1st fee - Brian - $500.00<BR>
2nd fee - John - $500.00<BR>
3rd fee - Bob - $750.00<BR>"
Any help would be greatly appreciated, even if it’s just telling me give up, not possible. Thanks in advance!
So basically you just want to match everyhing from
- $until the first left arrow in the<br>. The first part of the pattern- \\$(need to escape the $ since that is a regex keyword) will match the beginning part of what you want removed, and then[^<]*will take everything until it finds a left arrow.Output: