News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
WebProNews.com:
Form Checking - Verifying Name Using PHP Ereg
June 23, 2006 @ 07:40:01

On WebProNews.com, there's a brief tutorial on using regular expressions, specifically for filtering "names" entered by users.

One important use of Regular Expressions (Regex) is to verify fields submitted via a form. In this article, we attempt to write an expression that is able to verify the user's first name, middle name, last name or just names in general.

The expression should allow names such as "Mary", "Mr. James Smith" and "Mrs O'Shea" for example. So the challenge here is to allow spaces, periods and single quotation marks in the name field and reject any other characters.

Their examples use the preg_* functions in PHP to work, first looking for any invalid characters in the string(s), then amending it to ensure that there aren't any numbers involved either. The few lines of code it takes are included as well.

0 comments voice your opinion now!
regular expression form checking verify preg regular expression form checking verify preg



Similar Posts

Paul Gregg's Blog: Want to try out the next major version of Delphi for PHP?

SitePoint PHP Blog: The Joy of Regular Expressions [4]

Symfony Blog: New in symfony 1.2: Small things matter (2)

WebProNews.com: Form Checking - Verifying Name Using PHP Ereg

Paul Gregg's Blog: Want to try out the next major version of Delphi for PHP?


Community Events











Don't see your event here?
Let us know!


zend code PEAR PHP5 releases release framework zendframework package ajax book cakephp conference application security example mysql developer job database

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework