I'm pretty new at the subject preg
and I'm using this preg_match
condition to check if the user has entered whitespace, unicode letters, digits, underscore or dash:
if(preg_match("/[^\040\pL\pN_-]/u", $term)) {
But now I wanted to allow a comma. So I tried this:
if(preg_match("/[^\040\pL\pN,_-]/u", $term)) {
And it actually works and I just wanted to know why. I just want to understand it better. Why does it have to be ,_-
and not -_,
for example to allow the comma?
I would really appreciate if someone could explain this to me step by step.