in reply to Regular Expression - Need HElp..pls

Something like this then?

m/ \A [[:alpha:][:digit:]] [[:alpha:][:digit:]-]* \z /x

Dave

Replies are listed 'Best First'.
Re^2: Regular Expression - Need HElp..pls
by ikegami (Patriarch) on Feb 16, 2006 at 15:51 UTC

    Shouldn't that be

    m/ \A (?: [[:alpha:][:digit:]] [[:alpha:][:digit:]-]* )? \z /x

    Your version requires that at least one character be present.

      You could be right. But since the OP doesn't specify whether or not the string must contain at least one character, I'd say that there is sufficient ambiguity in the definition of the problem that there's about an equal chance that mine is right. Good observation. Now the OP can choose which meets his needs.


      Dave