Support » Plugin: Participants Database » Regex Matches

Viewing 4 replies - 1 through 4 (of 4 total)
  • Never mind, I figured it out…

    ^(\d{3}-\d{3}-\d{4})*$ <!-- phone -->
    ^\d{5}(-\d{4})?$ <!-- zip -->

    Great plugin…

    Plugin Author xnau webdesign

    (@xnau)

    Bob,

    Regexes can be tricky, I know. It’s important to remember that the statement must include delimiters to work, that’s the most common mistake. You could try something like this for your phone number:

    /^\d{3}-\d{3}-\d{4}$/

    to strictly force your format. Be sure to tell your users what you’re expecting, the help field is good for that. The delimiter, if you don’t know, is the first and last character of the regex and should be something that is not in the regex statement itself, as in the example above.

    Your second example is slightly more tricky…you could try:

    /^\d{5}(-\d{4})?$/

    for that.

    I figured it out if you look above. I didn’t include the “#” in the examples, but I think that was the difference maker.

    Thanks again!

    Plugin Author xnau webdesign

    (@xnau)

    Glad you got it sorted.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Regex Matches’ is closed to new replies.