WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
regex question (2 posts)

  1. peter.twi
    Member
    Posted 9 months ago #

    Hi - We have a form that asks for an individual's age. Amazing what's out there.... A site called UtilMill.com lets you more or less use English and common sense to come up with a regex.

    For me, I wanted 3-15, inclusive, as all that's valid - i.e., 3,4,14,15 are among those acceptable; "A7" or 22 would both be rejected.

    The site said this was "the ticket;"
    \b0*([3-9]|1[0-5])\b

    But when I entered it PRECISELY as above, it did not get the job done.

    ... Thanks.

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

  2. Mike Challis
    Member
    Plugin Author

    Posted 9 months ago #

    The regex will have to begin and end with a forward slash

    Example: If you want numbers in a text field type but do not allow text, use this regex: /^\d+$/ Can be used for text, textarea, date and password field types.

Reply

You must log in to post.

About this Plugin

About this Topic