mercredi 7 octobre 2015

Checking phone numbers and email addresses against patterns

I would like to understand the following;

PHONE_REGEX = "^\d{3}-\d{3}-\d{4}$"

I know it used for checking phone numbers but I would like to understand each element:

^ does what? \d{3}- I gather its 3 digits but unsure of the rest. similarly: emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}" is partially understood - is there a good guide on this?

Aucun commentaire:

Enregistrer un commentaire