title: Finding many occurrences of custom built shortcode in String
body: <p>I'm building a quiz based system, and users can generate question types by entering something similar to a shortcode into the text area.  The plan is to be able to convert the shortcodes into HTML.  </p>
  
  <p>Here is an example of how users might write inside the text area:</p>
  
  <blockquote>
    <p>Here's a question</p>
    
    <p>What is your name?  [question type="text" question-answers="Mike|mike|Michael"]</p>
    
    <p>Male or Female?  [question type="radio" question-answers="Male" possible-answers="Male|Female" name="sex"]</p>
    
    <p>How many cars do you own  [question type="checkbox" question-answers="2" possible-answers="1|2|3|4" name="cars"]</p>
  </blockquote>
  
  <p>The users add the 'shortcodes' via a click of a button, and are given the options to add values to the attributes e.g question-answers etc... this saves them writing any 'code'. </p>
  
  <p>What I want to do is on submit (in the background),  convert all the shortcodes into html inputs. The actual converting won't be a problem, what I am having a problem with is finding the occurrences of all the shortcodes. </p>
  
  <p>I have tried using:</p>
  
  <pre><code>preg_match_all(SOME_REG_EX, $question, $matches);
  print_r($matches);
  </code></pre>
  
  <p>but I'm not getting anything useful, probably due to my regular expression being incorrect,  I have tried various regex's but not had any luck.    </p>