Welcome, Guest
Username: Password: Remember me

TOPIC: Regex validation not working

Regex validation not working 1 year 5 months ago #96629

  • nuin
  • nuin's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
Hi

We have a survey where users have to enter certain ID that can be recorded on the survey. Currently, our ID is a three-part string with a fixed initial prefix, a three-letter symbol followed by three numbers. Something like this:

CBN01_XXX_999

the three letter middle follows a strict rule and has 6-7 possibilities only, so our regex is

regexMatch(CBN01_[CQUTM][MUGWBCS][MHECAT]_[0-9][0-9][0-9])

I am using this on the Validation box of the question, and it does not seem to be working as, non allowed three-letter combinations are being accepted. I also tested this on the question validation equation box, with no success. The latter even makes a Javascript based mask for the field disappear.

Any help is appreciated.
The administrator has disabled public write access.

Regex validation not working 1 year 5 months ago #96630

  • gimletbiggles
  • gimletbiggles's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Thank you received: 1
  • Karma: 1
You need forward slashes and quotes:

regexMatch('/CBN01_[CQUTM][MUGWBCS][MHECAT]_[0-9][0-9][0-9]/')

But, the validation box already has regexMatch implemented, so just use:

/CBN01_[CQUTM][MUGWBCS][MHECAT]_[0-9][0-9][0-9]/
The administrator has disabled public write access.
The following user(s) said Thank You: nuin

Regex validation not working 1 year 5 months ago #96631

  • nuin
  • nuin's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
Thanks a lot, works perfectly.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.099 seconds
Donation Image