how to add hyphen

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
iffo
Forum Commoner
Posts: 37
Joined: Thu Oct 05, 2006 11:56 am

how to add hyphen

Post by iffo »

Hi,

This is my regex, I want them to be able to enter hyphen, how could I do that?


'regex' => '/^[A-Za-z\']{2,40}$/',
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Code: Select all

$regex = '/^[A-Za-z\'\-]{2,40}$/';
iffo
Forum Commoner
Posts: 37
Joined: Thu Oct 05, 2006 11:56 am

Post by iffo »

thans a lot
Post Reply