News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Custom profile fields: Regex (Advanced)

Started by JamesD01, August 30, 2008, 02:57:51 PM

Previous topic - Next topic

JamesD01

Sorry for my dumb question :-[, but what is the regex option for?
Best regards,
James

karlbenson

You can write regular expressions to match/check/validate the data that is entered.
Like it says, its an option really only for advanced users.

For example a regex to ensure that the data consisted of chars a-z and is 5 in length would look like
~^([a-z]{5})$~

JamesD01

Best regards,
James

H

-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

shumilica

Yes, I puted a regex for personal number identification, it gives an error when somebody enters an incorrect number but only in the error log, it doesn't stop anybody to register, it doesn't give a message like "Personal Number incorrect!"

This is the regex i used:
Romanian Personal Numeric Code (ro=Cod Numeric Personal) (example=1800101221144):
Quote\b[1-8]\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])(0[1-9]|[1-4]\d|
5[0-2]|99)\d{4}\b
taken from a blog, with many other, wich may interest somebody over here:
http://www.richardsramblings.com/2008/01/10/regex-patterns-for-personal-data/


Today, if you're not confused it means you're not thinking clear!

Advertisement: