Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

Input Mask with Regex not filtering

Aloittaja escaperadius, helmikuu 22, 2009, 07:00:08 IP

« edellinen - seuraava »

escaperadius

I have created a custom profile field where I want a user to enter a vaild domain name (like hxxp:www.mysite.com [nonactive]) at registration.

In the Edit Profile Field->Advanced Settings: form I have selected Regex (Advanced) and placed
^(http|https)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$

The custom field appears on the registration page however it doesn't force the regex validation rule. It does reject registration if the domain name field is empty.

What needs to be done to correct this and enforce the regex validation?
Thanks,
Chris

karlbenson

It doesn't look like a good regex to me.

Besides the fact you should start and end with the same character. (has to be not included in your regex or has to be escaped everytime in regex eg

~^[a-z]+$~ (since tilda is not allowed in url unencoded)

Advertisement: