We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3806
    • 6 Posts
    Hi

    I’m using jot as follows
    [!Jot? &action=`form` &tplForm=`BlogForm` &captcha=`1` &customfields=`name,email,website` &validate=`email:Not a valid e-mail address.:email,website:Not a valid website:^((http://[a-zA-Z0-9\-\.]+\.[a-zA-Z0-9]+))^` !] 
    


    It shows a form where a user can post a comment for the page. I have three custom fields. Name, email and website. Currently the validation of the website, causes some headaches. By a website I mean a valid URL. I want the website either to be valid or to be empty. The current regex

    ^http://[a-zA-Z0-9\-\.]+\.[a-zA-Z0-9]+^
    


    makes aure that it is a valid website, but how do I extend the regular expression so it also allows websites to be the empty string. I did try by adding |.{0} but it did not work.

    Best Regards
    Niels