Cubehead Posted October 18, 2006 Share Posted October 18, 2006 Hi, I would like to test something with this pattern "[a-z][a-z0-9_.-]{2,31}". How can I ensure that the string tested starts (or ends) with the pattern ? I've been trying to find the information in the manual (beta 3.2.1.10), without success. Thanks in advance. Link to comment Share on other sites More sharing options...
this-is-me Posted October 18, 2006 Share Posted October 18, 2006 Do you need a literal question mark or do you need to match a single character? Who else would I be? Link to comment Share on other sites More sharing options...
Cubehead Posted October 18, 2006 Author Share Posted October 18, 2006 (edited) Do you need a literal question mark or do you need to match a single character?I would like to check if a string is a valid login which can be between 3 and 32 character long, containing alphanumeric characters, with a possibility of the dot, hyphen or underscore, and starting with a alphabetic character. The pattern is matched, even if the string starts with a digit. Now that I think of it, maybe I should try an exclusion... Edit : found the solution. I can use ^ for a starting anchor and $ for an ending one. So my pattern should be "^([a-z][a-z0-9_.-]{2,31})$". I think that this information should go into the manual. Thanks for your time. Edited October 18, 2006 by Cubehead Link to comment Share on other sites More sharing options...
this-is-me Posted October 18, 2006 Share Posted October 18, 2006 (edited) "(?i)(\a[\a\d._-]){2,31}" Edited October 18, 2006 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now