Using the 'x' operator, you can use spaces in your matching pattern:
m/^[a-zA-Z]{0,20} [A-Za-z]{0,20}$/x
m/^[a-zA-Z]{0,20}\s [A-Za-z]{0,20}$/

Ofcourse, the +,?,* and so on could be used also for determing the character count.

m/^\'$/

Maybe this helps you.

Cheers
--------------
Bob Erinkveld (Webmaster Insane Hosts)
www.insane-hosts.net
MSN: [EMAIL PROTECTED]





From: Chuck Tomasi <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Wanted: Good Name Filtering regex
Date: Tue, 26 Nov 2002 05:56:40 -0600 (CST)

System Specs
============
Perl 5.6.1 (dev) 5.8.0 (prod)
Mac OS X 10.2.2 (dev) NetBSD 1.5.2 (prod)
MySQL 3.23.52

I'm writing a web form to accept user applications.  Like most programs,
I'd like to keep the garbage characters out to limit hacking attempts.
I want to verify the firstname and last name fall within some guidelines.
I realize there is a wealth of exceptions, but this program is designed to
be used largely by my family.  That isn't to say that others on the net
will try and hack it.  I was wondering if anyone could help me come up
with a good regular expression to allow only letters, spaces, and
apostrophes (e.g. O'Donnell, Van Linden would be valid).  I'm not quite
clear on how to do exceptions.

Ex: if ($st contains anything other than [a-zA-Z\s\']) {
	&Error("Stick with letters, spaces, and apostrophes please.");
	return 0;
   }

Thanks.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

_________________________________________________________________
Chatten met je online vrienden via MSN Messenger. http://messenger.msn.nl/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to