regex - Regular expression for e-mail:password (PHP) -
i not unfamiliar regexes, figured i'm much improve @ reading , understanding them @ writing them myself. can't work.
e-mail:password
basically, needs verify e-mail address , password of lengths, separated colon or without spaces around it.
passwords can include absolutely character, colons included. e-mails cannot include colons, far i'm aware can't anyways.
true:
em@il.com:password em@il.com : p@55w:rd em@il.co.uk :p@$ word em@il.com: passwordfalse:
nomail.com:password nom@ailcom: password nomail:password e:m@il.com:passwordthanks!
many f.j! help along e-mail verification markus sipilä use, became:
^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})[ ]?:.*$
of course, when adding f.j's bit of code ([ ]?:.*) end of e-mail verifying string, maintain in mind might have rid of end-of-line archors. adding "optional" part it, meaning either left empty (^$) or (|) follow string, makes:
(^$|^[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&'\*\+/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})[ ]?:.*$)
take a regex match email, , add together [ ]?:.*
end of (square brackets not necessary, create little easier see there single space there).
php regex email passwords
No comments:
Post a Comment