|  | Posted by shimmyshack on 02/16/07 19:13 
On Feb 16, 6:08 pm, Tom <t...@to.com> wrote:> On Fri, 16 Feb 2007 11:55:02 +0000, raj wrote...
 >
 > >Hi,
 >
 > >I have to repost this to restate the question. No disrespect to the original
 > >reply.
 >
 > >Please can someone help regarding providing a regular expression for entering
 > >a set of characters with letters, numbers, periods (.), hyphens (-), or
 > >underscores (_) only.
 >
 > >I need to do this using ereg
 >
 > >I've got as far as this but it doesn't quite work:
 >
 > >$pattern="^([a-z0-9.-_]{0,30})$";
 > >if(ereg($pattern,$_SESSION['id']))
 > >...
 >
 > >Thank you in advance.
 >
 > >Kind regards,
 >
 > >Raj (newbie)
 >
 > Normally with "preg" I need to put the hyphen last, otherwise it may confuse a
 > literal hyphen with the special character. Such as the hyphens you're using to
 > specify the range of letters and numbers. The same may apply to the function
 > you're trying to use.
 >
 > Tom
 > --
 > Newsguy.com - Basic Accounts $39.95 / 12 months
 > 75+ days of Binary and Text Retention!
 > Higher levels of article completion!
 > Broader coverage of newsgroups
 
 If by $_SESSION['id'] you mean the standard PHPSESSID, it has 32
 characters, no more no less, be default.
 If not then Tom is right, hyphen last.
 [Back to original message] |