Why does \s|\t|(\r ?\n) catch single white space , but (\r ?\n)|\s |\t does not?
I was testing my GUI text input for any white space, tab or new lines and noticed this.
I was testing on https://regexr.com/ if it makes a difference.
Why does \s|\t|(\r ?\n) catch single white space , but (\r ?\n)|\s |\t does not?
I was testing my GUI text input for any white space, tab or new lines and noticed this.
I was testing on https://regexr.com/ if it makes a difference.
\s matches whitespace characters. In your first example, you have a pattern that is just |\s|*, but in the second you have |\s |* (with a space AFTER the whitespace). So the second pattern requires TWO whitespace to match.
*I added the vertical bars to help show the extra whitespace. SO dropped the space without something following it
AH spacing matters. Characters are a valid token.
(\r?\n)|\s|\t =/= (\r ?\n)|\s |\t