I am trying to match all characters except the ones mentioned in the exclusion group, the symbol in the subject “some–text” is not a Hyphen / Minus sign its an En Dash Unicode Character “–” (U+2013)
preg_match("/[^↓a-zA-Z0-9" . preg_quote(".\+*?[^]$(){}=!<>|:#") . "~@%&_;'",\/ rnαβγδθλμπφΔΦΩØ°±≤≥↑∞⁰¹²³⁴⁵⁶⁷⁸⁹₀₁₂₃₄₅₆₇₈₉]/", "some–text");
The above code does not work as expected, returns 0 instead of 1
preg_match("/[^↓a-zA-Z0-9" . preg_quote(".\+*?[^]$(){}=!<>|:#") . "~@%&_;'",\/ rnαβγδθλμπφΔΦΩØ°±≤≥↑∞⁰¹²³⁴⁵⁶⁷⁸⁹₀₁₂₃₄₅₆₇₈₉]/", "some`text");
In the above code if I change the symbol in the subject to back tick ` it works and returns 1
preg_match("/[^a-zA-Z0-9" . preg_quote(".+*?[^]$(){}=!<>|:#") . "~@%&_;'",/ rnαβγδθλμπφΔΦΩØ°±≤≥↑∞⁰¹²³⁴⁵⁶⁷⁸⁹₀₁₂₃₄₅₆₇₈₉]/", "some–text");
If I remove the Downwards Arrow ↓ from pattern and keep the En Dash “–” in Subject, it starts working and the above code returns 1
preg_match("/[^↓]/", "some–text");
If I remove all other characters and keep only Downwards Arrow ↓ in the exclusion group, it works and return 1, so it not the Downwards Arrow symbol causing the problem
Can somebody tell me what is going on, I just want to match all characters except these
a-zA-Z0-9~@%&_;'",/ rnαβγδθλμπφΔΦΩØ°±≤≥↓↑∞⁰¹²³⁴⁵⁶⁷⁸⁹₀₁₂₃₄₅₆₇₈₉
which includes space and newline characters r and n