/^\w(?:[\w\s]*\w)?$/  works well for multiple words, but how do I check a
date that is in the format 01/22/03

I think that it is hanging up on the / 


Thanks for everyone's help.

Sander

-----Original Message-----
From: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 1:09 PM
To: Rob Dixon; [EMAIL PROTECTED]
Subject: RE: Quick regex prob




> Dan Muey wrote:
> > Hiya, I'm having a brain melt right now :
> >
> > I do this to match one word only.
> > m/^(\w+)$/)
> 
> That matches an entire line which is just a string of 'word' 
> characters ( A-Z, a-z, 0-9, and underscore ).
> 
> > What regex do I need to match multiple , unkown ammounts of words? 
> > Will this do it? Or is there a better way? m/^\w[\w*|\s*]\w$/
> 
> Well, it doesn't seem a very interesting thing to want to do, 
> but I think you mean:
> 
>     /^\w[\w\s]*\w$/

yup
> 
> which matches an entire line consisting of word characters or 
> whitespace, with no leading or trailing whitespace. Is that 
> what you wanted?
> 
> One restriction - the least thing it'll match is two word 
> characters. If you want a single-character line to match do this:
> 
>     /^\w(?:[\w\s]*\w)?$/

cool
> 
> which still won't match an empty line. Do you need that too?

I don't think so but if I did all I would need to is :
/(^$)|(^\w(?:[\w\s]*\w)?$)/

Right?

Thanks again Rob , I'm getting farther and farther from that genius award!


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

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

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

Reply via email to