Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Regex validation not working

Regex validation not working 1 Jahr 3 Monate her #96629

  • nuin
  • nuins Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Regex validation not working 1 Jahr 3 Monate her #96630

  • gimletbiggles
  • gimletbiggless Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 4
  • Dank erhalten: 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]/
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: nuin

Regex validation not working 1 Jahr 3 Monate her #96631

  • nuin
  • nuins Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 11
  • Karma: 0
Thanks a lot, works perfectly.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.126 Sekunden
Donation Image