Username update (#39)

As pointed out by @jdp - `\d` and `_` are a subset of `\w`.

Maybe worth mentioning that most places don't allow usernames to start with a number, underscore, or dot.

Even more generally speaking, these are nice toy/model illustrations, but maybe it's worth pointing out that while fun for practice, maybe regex isn't the best way to validate some of these things.
This commit is contained in:
Loisaida Sam 2017-08-11 10:01:09 -04:00 committed by Zeeshan Ahmed
parent e390ba3fb2
commit c1cfb1e6fe

View File

@ -474,7 +474,7 @@ line. And because of `m` flag now regular expression engine matches pattern at t
* *US Phone Number*: `^+?[\d\s]{3,}$`
* *US Phone with code*: `^+?[\d\s]+(?[\d\s]{10,}$`
* *Integers*: `^-?\d+$`
* *Username*: `^[\w\d_.]{4,16}$`
* *Username*: `^[\w.]{4,16}$`
* *Alpha-numeric characters*: `^[a-zA-Z0-9]*$`
* *Alpha-numeric characters with spaces*: `^[a-zA-Z0-9 ]*$`
* *Password*: `^(?=^.{6,}$)((?=.*[A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z]))^.*$`