brodie28 Posted September 26, 2008 Share Posted September 26, 2008 All sorts of random symbols get included as being alpha numeric. For instance ß and all sorts of other ones. Is there a way to just evaluate a string to see if it is a-z 0-9? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 26, 2008 Moderators Share Posted September 26, 2008 (edited) All sorts of random symbols get included as being alpha numeric. For instance ß and all sorts of other ones. Is there a way to just evaluate a string to see if it is a-z 0-9?StringRegExp($s_text, "(?i)\A[a-z0-9]+\z") Edit: In other words: If StringRegExp($s_text, "(?i)\A[a-z0-9]+\z") Then MsgBox(64, "Info", "String is a to z or 0 to 9") Edited September 26, 2008 by SmOke_N Was only checking for 1 character from begining to end Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
brodie28 Posted September 26, 2008 Author Share Posted September 26, 2008 thanks. I never could get my heard around regexp... What would I do to include "-" and "_" in that? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 26, 2008 Moderators Share Posted September 26, 2008 (edited) thanks. I never could get my heard around regexp... What would I do to include "-" and "_" in that?"(?i)\A[a-z0-9_-]\z" Edit: Sorry, I am only checking 1 char there. It's this: "(?i)\A[a-z0-9_-]+\z" Edited September 26, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
brodie28 Posted September 26, 2008 Author Share Posted September 26, 2008 That didn't work. That only returns strings that are one character long. I want it to return all strings that contain nothing but a-z, 0-9 and _ - Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 26, 2008 Moderators Share Posted September 26, 2008 That didn't work. That only returns strings that are one character long. I want it to return all strings that contain nothing but a-z, 0-9 and _ -Did you see my edit above ? Anyway... on your other topic, now that I think these two are related... This was half the time:FileClose(FileOpen("passlist_checked_.txt", 2)) $i_time = TimerInit() Local $a_array For $i = 1 To 1 If FileExists("passlist" & $i & ".txt") Then $a_array = StringRegExp(FileRead("passlist" & $i & ".txt"), "(?i)(?:\A|\n)([a-z0-9_-]+)(?:\z|\r)", 3) _FileWriteFromArray_Append("passlist_checked_.txt", $a_array, 0) EndIf Next ConsoleWrite("It took: " & (TimerDiff($i_time) / 1000) & " seconds to finish 1 file." & @CRLF) Func _FileWriteFromArray_Append($s_file, $a_array, $i_base = 0, $i_ubound = 0) If IsArray($a_array) = 0 Then Return SetError(1, 0, 0) If FileExists($s_file) = 0 Then FileClose(FileOpen($s_file, 2)) If $i_ubound = 0 Or $i_ubound = -1 Or $i_ubound = Default Then $i_ubound = UBound($a_array) - 1 Local $s_write_to_file = FileRead($s_file) If $s_write_to_file <> "" Then $s_write_to_file = StringRegExpReplace($s_write_to_file, "[\r\n]+\z", "") & @CRLF EndIf For $i = $i_base To $i_ubound $s_write_to_file &= $a_array[$i] & @CRLF Next Return FileWrite($s_file, StringTrimRight($s_write_to_file, 2)) EndFunc And much less code >_< ... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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