SMF Support > SMF 2.0.x Support
Custom profile fields: Regex (Advanced)
(1/1)
JamesD01:
Sorry for my dumb question :-[, but what is the regex option for?
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:
Ahh, thanks for your reply.
H:
These two links are very helpful if you want more information :)
http://en.wikipedia.org/wiki/Regular_expression
http://regexlib.com/
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
--- End quote ---
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/
Navigation
[0] Message Index
Go to full version