title: PHP regex replace from string to string
body: <p>I want to replace a section of a string based that starts with one string and ends with another, and I want the section between also replaced. I think this is possible using regex but I cant' seem to find any decent examples showing this.</p>
  
  <p>For Example:</p>
  
  <pre><code>I have "http://www.website.com" and I want to replace from "www" to "com" with "123xyz".
  So"http://www.website.com/something" becomes "http://123xyz/something.
  </code></pre>
  
  <p>I am assuming I have to use preg_replace(), and I think the regex should start with "^www" and end with "com$", but I cant seem to get a grasp of the syntax of regex enough to create the desired effect.</p>
  
  <p>please help</p>