Capture phone number from contact form

Form number can be written in various forms, with (), with – or with + sign. Instead of asking for a seperate field in contact form, you can capture it from withing text form  using regex.


Regex for Phone number: [\d\(\)\+\- ]{7,}

Explanation of Regex pattern: It basically means,  find a group that contains digit, (,),+,- or space and which is at least 7 characters long. This will roughly equate to phone number in the contact form.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s