12 May
2004
12 May
'04
8:02 p.m.
From: "Jianping Zhu" <jzhu@fisher.forestry.uga.edu>
The situation is that i want user to register. and i want to check the user-provid email address format.
<dtml if "email=='' or.....">
how can I check the email format?
Create an external method with the following code: import re def isEmail(value): p = re.compile(r"(([\'a-zA-Z0-9\_-])*\.)*([\'a-zA-Z0-9\_-])+@([a-zA-Z0-9\_-])+(\ .([a-zA-Z0-9])+)+") if p.match(value) : return 'Valid' else: return 'Invalid' Then you can use dtml to check your email addresses: <dtml-if "isEmail(somevar) == 'Valid' "> where 'somevar' is the form field that captured the email address entered by the user. HTH Jonathan