Regex tester bug
Author: nyoffe-wnlCreated Jun 9, 2026Updated Aug 7, 2026
Labelsbugtriage
Describe the bug
The following phone number regex seems to not work properly: ^(?\d{3})?(\s|-)?\d{3}(\s|-)?\d{4}$ I'm running it against a string of just 10 digits and it's mandating a space or hyphen for (\s|-)? when the ? should allow it to be optional.
What happened?
System information
Windows 11, Vivaldi and Chrome
Where did you encounter the bug?
Public app (it-tools.tech)
Source: CorentinTh/it-tools