This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

RegEx for allowing alphanumeric at the starting and hyphen thereafter

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 0.20 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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])?$
clone this paste RAW Paste Data