Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

Regular Expressions (Regex)

Ghislain B. edited this page May 16, 2015 · 21 revisions

From the example displayed, I introduce the custom regular expression, there is no limitation on regex itself and you can even use the pipe " | " within it and without being scared of interfering with the other validation filters BUT you have to follow a specific pattern (a writing pattern that is), and if you don't, well it will simply fail. Let's explain how it works...

Regex validation is divided in 4 specific parts (Step #1-4).

Let's use the previous Examples #6 and extract the information out of it to see how it works. Step #1-4 are for explanation only, at the end we show the full regex (make sure there is no spaces).

  1. Start & end the filter with the following regex: :regex which tells the directive where to extract it.

  2. Custom error message YYWW (what do we want to display to the user, it will be appended to INVALID_PATTERN, refer to the translation file. In english it will display the following: Must be following this format: YYWW)

  3. Followed by a separator which basically says... after := separator comes the regex pattern

  4. Custom regex pattern ^(0[9]|1[0-9]|2[0-9]|3[0-9])(5[0-2]|[0-4][0-9])$

Final code (without spaces):

regex:YYWW:=^(0[9]|1[0-9]|2[0-9]|3[0-9])(5[0-2]|[0-4][0-9])$:regex

Clone this wiki locally