title: I am confuse how to replace string preg replace
body: <p>I am stuck the whole day thinking how to change <code>[img]imagesrc[/img]</code> to <code>&lt;img src='imagesrc' /&gt;</code>.
  Well, in this case i can use <code>str_replace</code> to solve. Just curious is it possible to do it with <code>preg_replace</code>?</p>
  
  <p>another problem i cant solve using <code>str_replace</code> is change <code>[size=14]text[/size]</code> to something like <code>&lt;font style='font-size:14px'&gt;text&lt;/font&gt;</code>.</p>
  
  <p>Someone please help me.</p>
  
  <p><strong>Edited</strong></p>
  
  <pre><code>$content = [img]imagesrc[/img];
  $content = str_replace("[img]", "&lt;img src='", $content);
  $content = str_replace("[/img]", "' style='width:100%'/&gt;", $content);
  </code></pre>
  
  <p>This is what I had done with [img] using <code>str_replace</code>. Just want to know any solution by using <code>preg_replace</code> since I cant solved <code>[size=14]text[/size]</code> with <code>str_replace</code>.</p>
  
  <p>I just wonder why people always complaint my question is not related or any other reason. I am a newbie thats why I seeking for help here. Isn't here a platform seeking for help? I am not asking for answer directly without trying, I just asking for alternative and better solution to improve my skill.</p>