1 Replies - 6117 Views - Last Post: 22 June 2016 - 10:11 AM

#1 borninlyoko  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 7
  • View blog
  • Posts: 350
  • Joined: 03-December 09

Username

Posted 21 January 2010 - 02:28 PM

Description: Put into RegEx accepting Application.This uses a character set to allow people to create a username from 4 to 16 characters using the characters 0-9, a-z, A-Z, - and _.
[a-zA-Z0-9_-]{4,16}http://www.dreamincode.net/forums/showtopic17947.htm

Is This A Good Question/Topic? 0
  • +

Replies To: Username

#2 dday9  Icon User is offline

  • D.I.C Regular

Reputation: 94
  • View blog
  • Posts: 495
  • Joined: 17-April 13

Re: Username

Posted 22 June 2016 - 10:11 AM

Your code can be simplified to:
[\w-]{4,16}


As the word character class(\w) will match any alphanumeric lexemes as well as underscores.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1