title: Delete all substrings from given string that begin with certain chars
body: <p>I have a giant string and I want to delete all substrings within that string that start with a particular set of characters, in this case (' http) and end with a space. Framed differently, I want to delete all words (urls) that begin with (' http) - note the space as I have urls that begin with a parenthesis that I don't want to delete e.g., '(http..)' So far what I have looks like this but I'm not sure if regex is a better option here?</p>
  
  <pre><code>while (strpos($body, ' http') !== false) {
        $beginningPos = strpos($body, ' http');
        $endPos = // somehow find the location of the first occurrence of a space after $beginningPos 
        // delete substring between $beginningPos and endPos
  }
  </code></pre>