1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Help with regexp...

Discussion in 'Fabrik 2.0 Beta Testing' started by postb99, Dec 5, 2008.

Thread Status:
Not open for further replies.
  1. postb99

    postb99 New Member

    Level: Community
    Hello,

    I'm a bit a newbie with regexp. The following fails with regexp plugin (SVN 833).

    Regexp :

    Code (Text):

    /^[0-9]{2}/[0-9]{2}/[0-9]{4}$/
     
    Failure when submitting form :

    Code (Text):

    Warning: preg_match() [function.preg-match]: Unknown modifier '[' in W:\var\www\actiwan\components\com_fabrik\plugins\validationrule\regex\regex.php on line 87
    Call Stack
    #   Time    Memory  Function    Location
    (...)
    8   0.9103  13988328    FabrikModelRegex->validate( )   ..\form.php:1064
    9   0.9109  13988744    preg_match ( )  ..\regex.php:87
     
    My test form has a date field I want to control format of (using custom %d/%m/%Y ,format as you can guess from the regexp), several text input fields.

    Thanks,

    Barbara
     
  2. Francesco

    Francesco New Member

    Level: Community
  3. rob

    rob Administrator Staff Member

    Level: Community
    at a very big guess I would say you need to escape the forward slashes?:

    /^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/
     
  4. postb99

    postb99 New Member

    Level: Community
    Hi Rob,

    You solved it, forward slashes indeed need to be escaped :)

    Barbara
     
Thread Status:
Not open for further replies.

Share This Page