23. Valid Username Regular Expression - Java | Strings | Hackerrank

preview_player
Показать описание
You are updating the username policy on your company's internal networking platform. According to the policy, a username is considered valid if all the following constraints are satisfied:

The username consists of 8 to 30 characters inclusive. If the username consists of less than 30 or greater than 8 characters, then it is an invalid username.
The username can only contain alphanumeric characters and underscores (_). Alphanumeric characters describe the character set consisting of lowercase characters , uppercase characters , and digits .
The first character of the username must be an alphabetic character, i.e., either lowercase character or uppercase character .
Рекомендации по теме
Комментарии
Автор

But how can we come to know that why and where we have to use regular expression?

shraddhakshirsagar
Автор

Muito bom, estou com uma duvida quando se uma vírgula, se eu tiver um valor com, (vírgula) exemplo 124, 56 como ficaria?

rubenalbertassi
Автор

^[a-zA-Z]\\w_{7, 29}$ why this not getting accepted?

avijitdey
Автор

$ give error
I performed exactly as same ur code.

anujjain
Автор

no need to use ^ and $ at start and end

sourabhtripathi