I read basic regular expressions on different sites to learn them. my problem is that I do not understand some of them. here is an example I'm looking at to check the email address from w3schools
$email = test_input($_POST["email"]);
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) {
$emailErr = "Invalid email format";
}
I don’t understand the part, [\w\-]+as I understand it, it says "a string that has at least alphanumeric". can you give me a clear explanation for this?
source
share