I'm trying to create a regular expression with preg_match that can detect a string with the following requirements:
- Must contain at least 10 characters.
- There must be at least one of these: / (slash) . (dot) @ (arroba).
- Must not contain any of these letters: =, *, _, x, y, z
I think that I know how to achieve each requirement individually (maybe one of these is wrong), my problem is that I don't know how to concatenate all in a single expression.
- [a-ZA-Z]{10,}
- [/.@]
- [^=*_xyz]
The following scenarios must return 1 (or true).
$string1 = "Mega/lodon";
$string2 = "Megalo.don";
$string3 = "Me@galo/doing";
The following scenarios must return 0 (or false).
$string4 = "Meg@loz=on";
$string5 = "Meglo*don";
$string6 = "Megzlodonx";
$string7 = "=egalodoing";
This is what I'm trying:
preg_match("/[a-zA-Z]{10,}.[\/.@]?.[^=*xyz]/", $string1);