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$/

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)?$/

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

Cheers,

Rob




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

Reply via email to