Guest User

RegEx for allowing alphanumeric at the starting and hyphen thereafter

a guest
Feb 26th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. a
  2.  
  3. ^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$
  4.  
  5. ^[[:alnum:]](?:[[:alnum:]-](?!-$))*$
  6.  
  7. ^(?:[[:alnum:]]+(?:-(?!$))?)+$
  8.  
  9. ^(?:[a-zA-Z0-9]+(?:-(?!$))?)+$
  10.  
  11. ^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$
Add Comment
Please, Sign In to add comment