CF8 - Regular expression

Validate specific gift card numbers with a regular expression in ChronoForms.

Overview

The regular expression contained extra zeros, causing validation to fail for the intended number patterns.
Correct the regular expression by removing the extra zeros to match the exact gift card number formats.

Answered
ChronoForms v8
gabi gabi 31 Oct, 2023
I am about to recreate my forms in CF8.
In one of my forms I am validating with Regular expression. It worked last year in CF7, but now it is not working anymore.
It keep saying invalid number, even in CF7.
I have 5 fields for giftcard numbers and I want to validate that the correct number is used.
The number are:
BLDCT-006
BLDCT-007
BLDCT-008
BLDCT-009
BLDCT-010

Used Regular expression:

/^BLDCT-000[6-9]|BLDCT-001[0]$/

I got help for this here on forum and hope someone can help me out again to get this working.

The Homepage: https://sup.linedancetoender.dk/index.php/bordertraef-da/bordertraef-tilmelding-2024-da

CF8 - Regular expression image 1
Max_admin Max_admin 05 Nov, 2023
Answer
your regex is wrong because it has extra 0

/^BLDCT-000[6-9]|BLDCT-001[0]$/
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
gabi gabi 06 Nov, 2023
Oh. Thank you very much.
Got it. Also there was an extra 0 before [6-9]

/^BLDCT-00[6-9]|BLDCT-01[0]$/

and it is working now.
This topic is locked and no more replies can be posted.