WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
regex for phone numbers (2 posts)

  1. OhYa1337
    Member
    Posted 1 year ago #

    Was wondering if anyone has figured out a way to implement an input mask for a telephone number field, I need to be able to accept with and without dashes and periods would be nice.
    So all these would be valid
    987-654-3210, 9876543210, or 987.654.3210

    I am currently using this,
    /\d{3}-\d{3}-\d{4}/

    but that only allows with dashes

    Thanks!

    http://wordpress.org/extend/plugins/si-contact-form/

  2. Ming Sheu
    Member
    Posted 1 year ago #

    My regex is a little rusty but you can try this

    /\d{3}[-\.]{0,1}\d{3}[-\.]{0,1}\d{4}/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.