What is the meaning of [\w\-] regular expression in PHP

toki

I was trying to understand about validating email in the following link - http://www.w3schools.com/PHP/php_form_url_email.asp

I know that \w means alphanumeric characters i.e. [0-9a-zA-Z] and - should mean to include a "-" as well. I got confused because they have used it after the "." as well, I think that after "." only alphanumeric characters can appear such as "com" , "org" etc.

abc123

Regex 101

\w explained

\w match any word character [a-zA-Z0-9_]

\w\- explained

\w\-
    \w match any word character [a-zA-Z0-9_]
    \- matches the character - literally

Matching Email Addresses Simple, not future proof

\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}\b

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Meaning of Regular Expression with JavaScript and PHP

From Dev

What's the meaning of ^ and $ symbols in regular expression?

From Dev

What is the meaning of the Regular Expression ^(.)\1+$

From Dev

What's the meaning of python regular expression “\2”

From Dev

Meaning of "*" in a regular expression for grep

From Dev

meaning of dollar symbol in regular expression

From Dev

What is the meaning of expression "+ + a"?

From Dev

Regular Expression \w is not working

From Dev

regular expression - /\w\b\w/

From Dev

`at` command: what is the meaning of the option `-w`?

From Dev

`at` command: what is the meaning of the option `-w`?

From Dev

What is the meaning of the following expression in scala?

From Dev

What is the meaning of the following expression in scala?

From Dev

What's the meaning of this expression in Java?

From Dev

What is the meaning of expression a = b != c;

From Dev

What is the difference between \d+ and \d- OR \w+ and \w- in regular expression terms?

From Dev

Does -* have any special meaning in regular expression?

From Dev

Meaning of \d{1-3 }in regular expression

From Dev

w word regular expression headache

From Dev

Regular Expression Explanation [\w-\.]

From Dev

What is the meaning of " |= " in php?

From Dev

what is the meaning of "? :" operator PHP

From Dev

What is the meaning of the "?" in this statement in php

From Dev

What are `\.` and `i` in a regular expression?

From Dev

What is the definition of a regular expression?

From Dev

Java Regular Expression: what is " '- "

From Dev

What will be the regular expression for this?

From Dev

What is happening with this regular expression?

From Dev

Explain what this PHP regular expression means (preg_match_all)

Related Related

  1. 1

    Meaning of Regular Expression with JavaScript and PHP

  2. 2

    What's the meaning of ^ and $ symbols in regular expression?

  3. 3

    What is the meaning of the Regular Expression ^(.)\1+$

  4. 4

    What's the meaning of python regular expression “\2”

  5. 5

    Meaning of "*" in a regular expression for grep

  6. 6

    meaning of dollar symbol in regular expression

  7. 7

    What is the meaning of expression "+ + a"?

  8. 8

    Regular Expression \w is not working

  9. 9

    regular expression - /\w\b\w/

  10. 10

    `at` command: what is the meaning of the option `-w`?

  11. 11

    `at` command: what is the meaning of the option `-w`?

  12. 12

    What is the meaning of the following expression in scala?

  13. 13

    What is the meaning of the following expression in scala?

  14. 14

    What's the meaning of this expression in Java?

  15. 15

    What is the meaning of expression a = b != c;

  16. 16

    What is the difference between \d+ and \d- OR \w+ and \w- in regular expression terms?

  17. 17

    Does -* have any special meaning in regular expression?

  18. 18

    Meaning of \d{1-3 }in regular expression

  19. 19

    w word regular expression headache

  20. 20

    Regular Expression Explanation [\w-\.]

  21. 21

    What is the meaning of " |= " in php?

  22. 22

    what is the meaning of "? :" operator PHP

  23. 23

    What is the meaning of the "?" in this statement in php

  24. 24

    What are `\.` and `i` in a regular expression?

  25. 25

    What is the definition of a regular expression?

  26. 26

    Java Regular Expression: what is " '- "

  27. 27

    What will be the regular expression for this?

  28. 28

    What is happening with this regular expression?

  29. 29

    Explain what this PHP regular expression means (preg_match_all)

HotTag

Archive