title: Regex (JavaScript): match feet and/or inches
body: <p>I'm trying to match <strong>feet and inches</strong> but I can't manage to get "and/or" so if first half is correct it validates:</p>
  
  <p>Code: (in javascript)</p>
  
  <pre><code>var pattern = "^(([0-9]{1,}\')?([0-9]{1,}\x22)?)+$";
  
  function testing(input, pattern) {
          var regex = new RegExp(pattern, "g");
          console.log('Validate '+input+' against ' + pattern);
          console.log(regex.test(input));
      }
  </code></pre>
  
  <p>Valid tests should be:</p>
  
  <ul>
  <li><code>1'</code></li>
  <li><code>1'2"</code></li>
  <li><code>2"</code> </li>
  <li><code>2</code> (assumes inches)</li>
  </ul>
  
  <p>Not valid should be:
  * anything else including empty
  * <code>1'1'</code></p>
  
  <p>But my regex <strong>matches</strong> the invalid <code>1'1'</code>.</p>