WordPress.org

Support

regex question

  • 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/

Viewing 1 replies (of 1 total)
  • Plugin Author Mike Challis

    @mikechallis

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘regex question’ is closed to new replies.
Skip to toolbar