How do I use IS_MATCH for field validation if the field only contains data?

This works for me:
IS_MATCH('^\d{10}', extract=True, error_message='Telephone number should 
have 10 digits.')

so long as a 10 digit number is required.

But what if I a want to make it acceptable to enter a 10 digit number or 
leave the field blank?

Is there a way to make the IS_MATCH validator checked only if a non-empty 
string has been passed to the FORM for that field?

Apologies if this is a very obvious question - but I've tried several 
approaches and haven't come up with a satisfactory solution.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to