Regex tester bug
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)
Hey, there's a small issue with your regex. In the pattern ^(?\d{3})?(\s|-)?\d{3}(\s|-)?\d{4}$, the (?\d{3})? part is invalid. After changing it to ^(\(\d{3}\))?(\s|-)?\d{3}(\s|-)?\d{4}$, everything works just fine.
Hi @nyoffe-wnl @cwm-peace there may also remain a bug about non capturing groups. if you are interested in an up to date version of it-tools, with many improvements, new tools, and bug fixes, as this repo is almost no more maintained, I made a fork here : https://github.com/sharevb/it-tools (https://sharevb-it-tools.vercel.app/ and docker images https://github.com/sharevb/it-tools/pkgs/container/it-tools)
Recommended to use kairoa: https://github.com/covoyage/kairoa. It is a cross-platform desktop application with a more modern UI and a better overall user experience.
Hi @luduoxin there is indeed some interesting tool in kairoa