Aceguy Posted May 4, 2009 Share Posted May 4, 2009 can Stringregexp be used to search an array... like dim $myarray[51] for $c=1 to 50 $myarray[$c]=random(1,50,1) next $str=Stringregexp($myarray, '25',3) or do i have to cycle through the array... for $c=1 to 50 $str=Stringregexp($myarray[$c], '25',3) next [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Authenticity Posted May 4, 2009 Share Posted May 4, 2009 (edited) You have to loop because the function excepts a string type and not an array type.Edit: ...but you can use _ArrayToString() if you like. Edited May 4, 2009 by Authenticity Link to comment Share on other sites More sharing options...
GEOSoft Posted May 4, 2009 Share Posted May 4, 2009 (edited) You might be able to work out a method based on this example ; #include <Array.au3> Local $aArray[50] For $i = 0 To Ubound($aArray) -1 $aArray[$i] = "" For $j = 1 To 3;; Generate 3 letters for each elelment $aArray[$i] &= Chr(Random(97, 122, 1)) Next Next _ArrayDisplay($aArray, "Starting Array") $sStr = _ArrayToString($aArray);; Create a string from the array $sRegEx = "(?i)\|?(\w*n\w*)\|?" $aRegExp = StringRegExp($sStr, $sRegEx, 3);; Find the combinations that contain the letter "n" _ArrayDisplay($aRegExp, "RegEx Array") ; EDIT Whoa up here. In your example you could have used _ArrayFindAll($myArray, 25, 1) Edited May 4, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Aceguy Posted May 4, 2009 Author Share Posted May 4, 2009 (edited) Thanks guys... i think _ArrayToString() would be better.... as (not mentioned) the string i would need to search for would be "M6 Txxx" where xxx is a 3 digit number. so $lines=_ArrayToString($lines,@cr) $reg=StringRegExp($lines,'\bm6\b.\bt\d*',3) thanks again both Edited May 4, 2009 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
GEOSoft Posted May 4, 2009 Share Posted May 4, 2009 _ArrayFindAll($myArray, "M6 T", 1, 0, 0, 1) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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