title: How to create optional field in regex validation (javascript)?
body: <p>I'm using <a href="https://www.debuggex.com/" rel="nofollow">https://www.debuggex.com/</a> to debug my regex and it looks like <code>^(\+?\d{2})\d{8}$</code> - it's supposed to check if phone number is <code>+1212345678</code>(#1) and it should also be ok if it was <code>+12 12345678</code>(#2) or just <code>12345678</code>(#3), but the only valid expression is #1 - what should I adjust to make it accept those 2 patterns as well?</p>