Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[b]die[/b] [b]if[/b] [navy]$first[/navy] [teal]=~[/teal] [green][i]/[\d@.]/[/i][/green][teal];[/teal]
Sorry, I not understand that sentence. Just that you want something with numbers. As that character class not contains numbers, I suppose you want it to contain :TurboSRT4 said:i have this following code which is returning errors if it contains a number?
[b]if[/b] [teal]([/teal][navy]$passwor[/navy] [teal]=~[/teal] [green][i]/[[highlight]\d[/highlight]\\\/~`@#\$%^&*()-_+=\[{\]}|"']/[/i][/green][teal])[/teal][teal]{[/teal]
[b]push[/b] [navy]@errors[/navy][teal],[/teal] [b]qq[/b][green][i](Password Is Invalid<BR>)[/i][/green][teal];[/teal]
[teal]}[/teal]
Then say it like that. Is shorter than enumerating all forbidden characters. By the way, your previous regular expression allows punctuations : dot ( . ), comma ( , ), colon ( : ), semicolon ( ; ), exclamation mark ( ! ), question mark ( ? ). Also note that french quotes ( « » ) are also allowed. And although you disallow dollar sign ( $ ), you still allow cent ( ¢ ), euro ( € ), pound ( £ ), yen ( ¥ ), etc.TurboSRT4 said:i want numbers and letters only
[gray]# allow word characters ( letters, digits and underscore )[/gray]
[b]if[/b] [teal]([/teal][navy]$passwor[/navy] [teal]!~[/teal] [green][i]/^\w+$/[/i][/green][teal])[/teal][teal]{[/teal]
[b]push[/b] [navy]@errors[/navy][teal],[/teal] [b]qq[/b][green][i](Password Is Invalid<BR>)[/i][/green][teal];[/teal]
[teal]}[/teal]
[gray]# allow alphanumeric characters ( letters, digits )[/gray]
[b]if[/b] [teal]([/teal][navy]$passwor[/navy] [teal]!~[/teal] [green][i]/^[[:alnum:]]+$/[/i][/green][teal])[/teal][teal]{[/teal]
[b]push[/b] [navy]@errors[/navy][teal],[/teal] [b]qq[/b][green][i](Password Is Invalid<BR>)[/i][/green][teal];[/teal]
[teal]}[/teal]
[gray]# allow the mentioned characters case insensitively[/gray]
[b]if[/b] [teal]([/teal][navy]$passwor[/navy] [teal]!~[/teal] [green][i]/^[a-z0-9]+$/[/i][/green][b]i[/b][teal])[/teal][teal]{[/teal]
[b]push[/b] [navy]@errors[/navy][teal],[/teal] [b]qq[/b][green][i](Password Is Invalid<BR>)[/i][/green][teal];[/teal]
[teal]}[/teal]
All three expressions allow both lowercase and uppercase characters.TurboSRT4 said:Hey thanks for your help man! your solution will not falter with case sensitivity?
All three expressions require at least one character.TurboSRT4 said:feherke, is there also a way to push the error if the field is blank without adding a seperate if statement thank you
[b]print[/b] USERS [green][i]"\n$[highlight]{[/highlight]usern[highlight]}
[/highlight]xx$[highlight]{[/highlight]passwor[highlight]}
[/highlight]xx$[highlight]{[/highlight]user[highlight]}
[/highlight]xx$[highlight]{[/highlight]street[highlight]}
[/highlight]xx$[highlight]{[/highlight]city[highlight]}
[/highlight]xx$[highlight]{[/highlight]state[highlight]}
[/highlight]xx$[highlight]{[/highlight]zip[highlight]}
[/highlight]xx$[highlight]{[/highlight]phone[highlight]}
[/highlight]xx$[highlight]{[/highlight]fax[highlight]}
[/highlight]xx$[highlight]{[/highlight]email[highlight]}
[/highlight]xx$company"[/i][/green][teal];[/teal]
[b]print[/b] USERS [green][i]"\n"[/i][/green][teal],[/teal]
[navy]$usern[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$passwor[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$user[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$street[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$city[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$state[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$zip[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$phone[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$fax[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$email[/navy][teal],[/teal][green][i]'xx'[/i][/green][teal],[/teal]
[navy]$company[/navy]"[teal];[/teal]
[b]print[/b] USERS
[green][i]"\n"[/i][/green][teal],[/teal][b]join[/b] [green][i]'xx'[/i]
[/green][teal],([/teal][navy]$usern[/navy][teal],[/teal]
[navy]$passwor[/navy][teal],[/teal][navy]$user[/navy][teal],[/teal]
[navy]$street[/navy][teal],[/teal][navy]$city[/navy][teal],[/teal]
[navy]$state[/navy][teal],[/teal][navy]$zip[/navy][teal],[/teal]
[navy]$phone[/navy][teal],[/teal][navy]$fax[/navy][teal],[/teal]
[navy]$email[/navy][teal],[/teal][navy]$company[/navy][teal]);[/teal]