title: PHP using regex to convert markdown similar syntax into image HTML tag
body: <p>I am creating some syntax similar to Markdown. Trying to convert the following syntaxes regardless of spacing between colons, attribute keywords, attribute values, or parentesis (the order of alt and class attributes shouldn't matter):</p>
  
  <pre><code>(image: profile.jpg alt: Michael class: profile)
  (image : profile.jpg alt : Michael class : profile)
  ( image : profile.jpg alt : Michael class : profile )
  </code></pre>
  
  <p>all into img tag correctly like</p>
  
  <pre><code>&lt;img src="profile.jpg" alt="Michael" class="profile"&gt;
  </code></pre>
  
  <p>The alt and class tag attributes won't always be used, so for example the following </p>
  
  <pre><code>(image: profile.jpg class: profile)
  </code></pre>
  
  <p>will become</p>
  
  <pre><code>&lt;img src="profile.jpg" class="profile"&gt;
  </code></pre>
  
  <p>and the following</p>
  
  <pre><code>(image: profile.jpg)
  </code></pre>
  
  <p>will become</p>
  
  <pre><code>&lt;img src="profile.jpg"&gt;
  </code></pre>
  
  <p>but sometimes the class values (or alt values) is comprised of more than one word like</p>
  
  <pre><code>(image: profile.jpg alt: Michael Jackson class: profile dark red)
  </code></pre>
  
  <p>and should become</p>
  
  <pre><code>&lt;img src="profile.jpg" alt="Michael Jackson" class="profile dark red"&gt;
  </code></pre>
  
  <p>I have tried to do this but failed due to the spaces between the attribute key words and values, don't know how to select them using preg_match() and/or preg_replace correctly.</p>
  
  <p>Thank you!</p>