Thread:Extension talk:Semantic Forms Inputs/Conditional Regular Expression/reply

The input is matched against a JavaScript style regexp. Maybe this helps: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

In principle it should be as easy as wrapping your whole regexp in parenthesis and appending a question mark.