Regex help

Discussion in 'PHP' started by Om ji Kesharwani, Oct 28, 2010.

  1. #1
    /^[\w\-\.]+$/

    Above Regex checks the username can have

    Only Letters,Numbers,Underscore,Hyphen and a single dot (.).

    But the problem is if he puts only dots or Hyphen he should be restricted
     
    Om ji Kesharwani, Oct 28, 2010 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    
    ^[a-zA-Z0-9_]{1,}$ 	// Any word of at least one letter, number or _
    
    PHP:
     
    MyVodaFone, Oct 28, 2010 IP