note
Roy Johnson
Note that a question mark after a quantifier (<code>{2}?</code>) does not mean optional, but rather non-greedy. You need to put parens around the sub-expression to make it optional:
<code>
/^(\d{6}\.?(?:\d{2})?\w?$/;
</code>
If the optionals aren't independent, you may need to nest them:
<code>
/^(\d{6} #leading digits
(?:\.? #if dot, then
(?:(?:\d{2})? #if two digits, then
\w?)))$/x; #maybe a character
</code>
Note the use of anchors, to prevent matching part of the name.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-300037">
<hr>
<small>We're not really tightening our belts, it just feels that way because we're getting fatter.</small>
</div></div>
376399
376399