More simplified version of the Regex is down bellow.
\+?([\da-z]+|((\([\da-z]+\)[\s-][\da-z]{2,})|([\da-z]+[\s-]\([\da-z]{2,}\))|([\da-z]+[\s-][\da-z]{2,}))([\s-][\da-z]+)+)
Inserted a regex like this, notice at the start it only checks for number and then | "or" a long sequence of characters.
The problem comes when i put the [\da-z]+ at the beggining, it starts ignoring all [\s-] sequences, but if i remove [\da-z]+ from the beggining and insert it to the end, it works correctly. I thought i had something wrong in my Regex, but after testing it in Java it works as expected.
Both cases matches a number : 123456
Only the case where [\d-z]+ at the end would match : +0 (123) 12345
Putting parantheses in various places encapsulating the | "or" did not change the result.
Reproduction steps
For simplicity sake here is a shorter regex that produce the same result :
\d+|(0 123-456) the white spaces or "-" are being ignored.
(0 123-456)|\d+ works correctly.
Expected Outcome
\d+|(0 123-456) doesn't match : 0 123-456
putting \d+ to the end instead howerver works correctly.
(0 123-456)|\d+ matches : 0 123-456
I don't believe this is a bug. I would recommend you join the irc chat (link in the left sidebar, "live help"), where you can get more information on this.
Bug Description
More simplified version of the Regex is down bellow.
\+?([\da-z]+|((\([\da-z]+\)[\s-][\da-z]{2,})|([\da-z]+[\s-]\([\da-z]{2,}\))|([\da-z]+[\s-][\da-z]{2,}))([\s-][\da-z]+)+)
Inserted a regex like this, notice at the start it only checks for number and then
|
"or" a long sequence of characters. The problem comes when i put the[\da-z]+
at the beggining, it starts ignoring all[\s-]
sequences, but if i remove[\da-z]+
from the beggining and insert it to the end, it works correctly. I thought i had something wrong in my Regex, but after testing it in Java it works as expected.Both cases matches a number : 123456 Only the case where
[\d-z]+
at the end would match : +0 (123) 12345Putting parantheses in various places encapsulating the
|
"or" did not change the result.Reproduction steps
For simplicity sake here is a shorter regex that produce the same result :
\d+|(0 123-456)
the white spaces or "-" are being ignored.(0 123-456)|\d+
works correctly.Expected Outcome
\d+|(0 123-456)
doesn't match :0 123-456
putting
\d+
to the end instead howerver works correctly.(0 123-456)|\d+
matches :0 123-456
Browser
Mozilla Firefox version 107.0
OS
Windows 10 Pro