in reply to Re^2: Regular Expression - Need HElp..pls
in thread Regular Expression - Need HElp..pls
Dave's exactly right! So, I'll recommend and explain something which combines our methods ...
/^[:alpha:][[:alpha:]\d-]*\z/I favor one-liners, but that's just a style preference. I changed my \w to [:alpha:], my ^ to \A, and my $ to \z per davido's recommendation, but I stuck with the \d because it's shorter and still works in this case. I left off the m at the beginning because that's the default anyway. I left off the x at the end because this regex doesn't use extended patterns (ref: Extended Patterns).
-- -- GhodMode
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Regular Expression - Need HElp..pls
by davido (Cardinal) on Jan 31, 2006 at 23:39 UTC |