Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9244539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:03:35+00:00 2026-06-18T09:03:35+00:00

Okay, I have a php loop that generates a string like this: $string =

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:03:36+00:00Added an answer on June 18, 2026 at 9:03 am

    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.

    $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>'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so i have this program that is suposed to communicate over a Webserver(PHP
Okay, I have a WebBrowser control in my VB.NET application that loads a PHP
Okay, I'm stuck. PHP, Regex. I have a string: Это кириллические 23 78these are56
Okay, we have a PHP script that creates an download link from a file
Okay, So I have a PHP file that uploads a image to my server.
Okay here's my situation. I have a php file that contains a simple form
Okay so I have a form that is using PHP to mail to an
Okay I have an array like this: array { [0] => array { [0]
Okay so I have a PHP script that makes a user an artist if
Okay I have this cool script I would like to bring to life, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.