tom13 Posted May 2, 2007 Share Posted May 2, 2007 (edited) Hi, I want a piece of code to be only executed if it has the following conditions:must contain at least one numeric character and one alphabetic charactermust differ from $var1must be between eight and sixteen characters in lengthmay only contain alphanumeric characters and punctuationâ such as A-Zâ 0-9â or !"#$%Update:While 1 $var1 = "var1" $string = InputBox("Test", "Input string:", "") $stringcheck = StringRegExp ( $string, "##What to put here??##" ) $stringchars = StringLen ($string) If $string <> $var1 Then If $stringchars < 8 OR $stringchars > 16 Then MsgBox(16, "Test", "$string has less then 8 or more then 16 characters!", 10) Exit Else MsgBox(64, "Test", $stringcheck, 10) EndIf Else MsgBox(16, "Test", "$string = $var1", 10) Exit EndIf WEndThis checks forNeeds to have more then 8 and less then 16 charactersmust be different from $var1Now I have these 2 left:may only contain alphanumeric characters and punctuationâ such as A-Zâ 0-9â or !"#$%must contain at least one numeric character and one alphabetic characterAnyone knows how to check for the last 2 ? Edited May 3, 2007 by tom13 Link to comment Share on other sites More sharing options...
Zedna Posted May 2, 2007 Share Posted May 2, 2007 StringRegExp() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
tom13 Posted May 2, 2007 Author Share Posted May 2, 2007 (edited) StringRegExp() I made this: $var1 = "fgdfg" $string = "opLKRE53" $stringcheck = StringRegExp ( $string, '[:alpha::ascii:]' ) If $string <> $var1 Then MsgBox(4096, "Test", $stringcheck, 10) Else MsgBox(4096, "They are the same", $stringcheck, 10) EndIf as return i get 0 which means "no match", though it does has a letter and a digit what am I doing wrong? edit: maybe im doing something wrong with [:alpha::ascii:] ? Edited May 2, 2007 by tom13 Link to comment Share on other sites More sharing options...
tom13 Posted May 3, 2007 Author Share Posted May 3, 2007 (edited) Update:While 1 $var1 = "var1" $string = InputBox("Test", "Input string:", "") $stringcheck = StringRegExp ( $string, "##What to put here??##" ) $stringchars = StringLen ($string) If $string <> $var1 Then If $stringchars < 8 OR $stringchars > 16 Then MsgBox(16, "Test", "$string has less then 8 or more then 16 characters!", 10) Exit Else MsgBox(64, "Test", $stringcheck, 10) EndIf Else MsgBox(16, "Test", "$string = $var1", 10) Exit EndIf WEndThis checks forNeeds to have more then 8 and less then 16 charactersmust be different from $var1Now I have these 2 left:may only contain alphanumeric characters and punctuation such as A-Z 0-9 or !"#$%must contain at least one numeric character and one alphabetic character Edited May 3, 2007 by tom13 Link to comment Share on other sites More sharing options...
tom13 Posted May 3, 2007 Author Share Posted May 3, 2007 (edited) Maybe this isn't possible? Edited May 3, 2007 by tom13 Link to comment Share on other sites More sharing options...
therks Posted May 3, 2007 Share Posted May 3, 2007 Well, it should be possible with something like: If StringRegExp($string, '[:alpha:]+') And StringRegExp($string, '[:digit:]+') ThenoÝ÷ Ø!ƧßÛ`zÛay©iª+v("µÉZ²ËhÂäjÖ¥Ê#ºËn±ëaz· ºV««)àr«iË^®Ä¨ëax%G+ºÚ"µÍYÝ[ÔYÑ^ ÌÍÜÝ[Ë ÌÎNÖØK^KVJÉÌÎNÊH[Ý[ÔYÑ^ ÌÍÜÝ[Ë ÌÎNÖÌNWJÉÌÎNÊH[ My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
tom13 Posted May 3, 2007 Author Share Posted May 3, 2007 Well, it should be possible with something like: If StringRegExp($string, '[:alpha:]+') And StringRegExp($string, '[:digit:]+') ThenoÝ÷ Ø!ƧßÛ`zÛay©iª+v("µÉZ²ËhÂäjÖ¥Ê#ºËn±ëaz· ºV««)àr«iË^®Ä¨ëax%G+ºÚ"µÍYÝ[ÔYÑ^ ÌÍÜÝ[Ë ÌÎNÖØK^KVJÉÌÎNÊH[Ý[ÔYÑ^ ÌÍÜÝ[Ë ÌÎNÖÌNWJÉÌÎNÊH[oÝ÷ Ûú®¢×©ä²f§¶ßÛ,¢ ÞjÐÒ¢[ÚºÚ"µÍÚ[HBÌÍÝHH ][ÝÝI][ÝÂÌÍÜÝ[ÈH[]Þ ][ÝÕÝ ][ÝË ][ÝÒ[]Ý[Î][ÝË ][ÝÉ][ÝÊBÌÍÜÝ[ØÚÈHÝ[Ó[ ÌÍÜÝ[ÊHY ÌÍÜÝ[È ÉÝÈ ÌÍÝH[Y ÌÍÜÝ[ØÚÈ ÈÔ ÌÍÜÝ[ØÚÈ ÝÈM[ÙÐÞ M ][ÝÕÝ ][ÝË ][ÝÉÌÍÜÝ[ÈÈÜÈ[Ü[ÜH[MÚXÝÉÌÌÎÉ][ÝËL BB^][ÙBYÝ[ÔYÑ^ ÌÍÜÝ[Ë ÌÎNÖØK^KVJÉÌÎNÊH[Ý[ÔYÑ^ ÌÍÜÝ[Ë ÌÎNÖÌNWJÉÌÎNÊH[BÙÐÞ ][ÝÕÝ ][ÝË ][ÝÒ] ÌÎNÜÈHÛÛÙÝ[É][ÝËL B[ÙBÙÐÞ ][ÝÕÝ ][ÝË ][ÝÒ] ÌÎNÜÈHYÝ[É][ÝËL B^][Y[Y[ÙBÙÐÞ M ][ÝÕÝ ][ÝË ][ÝÉÌÍÜÝ[ÈH ÌÍÝI][ÝËL BB^][YÑ[ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now