Valid Username Regular Expression

Sort by

recency

|

461 Discussions

|

  • + 0 comments

    public static final String regularExpression = "^[^\\W_\\d][\\w]{7,29}$";

  • + 0 comments

    `public static final String regularExpression = "[a-zA-Z][a-zA-Z0-9\_]{7,29}";

    [a-zA-Z] Matches any letter at the beggining

    [a-zA-Z0-9_] Matches any letter, digit or underscore. Equivalent to \w.

    {7,29} From 8 to 30, but counting here the beggining letter.

  • + 0 comments
    public static final String regularExpression = "[A-Za-z]\\w{7,29}";
    
  • + 0 comments

    short and enough public static final String regularExpression = "[a-zA-Z][a-zA-Z0-9_]{7,29}";

  • + 0 comments
    public static final String regularExpression = "^\p{Alpha}\w{7,29}$";

    this regex consits of: 1. one and only one alphabitic charachter at the begining 2. and 7 : 29 alphabitic, numeric or under score charachters.