Tom42 Posted May 30, 2007 Share Posted May 30, 2007 this is what I'm trying to doCreate multiple arrays base off file types (file names)Grab a list of files from a directory using FileListToArrayconvert the array to a string (FileListToArray allows for wildcards not RegExp)Filter string putting files that are 4 digits followed by ".fsh" in a new arrayThe next filter is where I'm screwing up, it is most likely a simple syntax errorThis filter should create an array of files that start with a "c" then 3 digits and ending with either ".fsh", ".orl", or ".ord". But this is my resultHere is my au3 code#include <String.au3> #include <array.au3> #include <file.au3> $FileList = _FileListToArray(@ScriptDir) _ArrayDisplay($FileList, 'StringRegExp Search') $newlist = _ArrayToString ( $FileList, ";") $aArray2 = StringRegExp ( $newlist, '(\d\d\d\d.fsh)',3) _ArrayDisplay($aArray2, 'StringRegExp Search') $Faces = StringRegExp ( $newlist, '(c\d\d\d.(fsh|orl|ord))',3) _ArrayDisplay($Faces, 'StringRegExp Search')I could convert that array to a string and use StringRegExp to grab all files that is 1 letter, 3 digits, a "." then 3 letters, but I would really like to know what I'm doing wrong Link to comment Share on other sites More sharing options...
jefhal Posted May 30, 2007 Share Posted May 30, 2007 (edited) c\d{3}.(fsh|orl|ord) this seems to work You might want to check out the regexp editor called Expresso 3.0 Beta... Edited May 30, 2007 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 30, 2007 Moderators Share Posted May 30, 2007 The \d.You're telling it to get the next character regardless what it is ....Do you have an example list we don't have to write out ourselves on how StringRegExp() is going to see the string? 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...
jefhal Posted May 30, 2007 Share Posted May 30, 2007 Hi Sm0ke_N- I think my regexp solves his problem... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 30, 2007 Moderators Share Posted May 30, 2007 Hi Sm0ke_N-I think my regexp solves his problem...I didn't see your post before I posted, but taking away the brackets will help for sure. 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...
Moderators SmOke_N Posted May 30, 2007 Moderators Share Posted May 30, 2007 Hi Sm0ke_N- I think my regexp solves his problem...Actually, that doesn't do what he wanted to do... #include <array.au3> $sFile = FileRead(@ScriptDir & '\testing.txt') $aCArray = StringRegExp($sFile, '\W(c\d{3}\.fsh|c\d{3}\.orl|c\d{3}\.ord)(?m:\r|$)', 3) _ArrayDisplay($aCArray, 'c')I think is more of what he was after. 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...
Tom42 Posted May 30, 2007 Author Share Posted May 30, 2007 Actually, that doesn't do what he wanted to do... #include <array.au3> $sFile = FileRead(@ScriptDir & '\testing.txt') $aCArray = StringRegExp($sFile, '\W(c\d{3}\.fsh|c\d{3}\.orl|c\d{3}\.ord)(?m:\r|$)', 3) _ArrayDisplay($aCArray, 'c')oÝ÷ Øay"²j+zð«a{¬iû^¯ú®¢×ºÚ"µÍÚ[ÛYH ÔÝ[Ë]LÉÝÂÚ[ÛYH Ø^K]LÉÝÂÚ[ÛYH Ù[K]LÉÝÂÌÍÑ[SÝHÑ[SÝÐ^JØÜBÐ^QÜ^J ÌÍÑ[SÝ ÌÎNÔÝ[ÔYÑ^ÙXÚ ÌÎNÊBÌÍÛ]ÛÝHÐ^UÔÝ[È ÌÍÑ[SÝ ][ÝÎÉ][ÝÊBÌÍØP^LHÝ[ÔYÑ^ ÌÍÛ]ÛÝ ÌÎNÊ ÌLÙ ÌLÙ ÌLÙ ÌLÙÚ IÌÎNËÊBÐ^QÜ^J ÌÍØP^L ÌÎNÔÝ[ÔYÑ^ÙXÚ ÌÎNÊBÌÍÑXÙÈHÝ[ÔYÑ^ ÌÍÛ]ÛÝ ÌÎNÉÌLÕÊÉÌLÙÌßIÌLËÚÉÌLÙÌßIÌLËÜÉÌLÙÌßIÌLËÜ JÛNÌLÜ ÌÍÊIÌÎNËÊBÐ^QÜ^J ÌÍÑXÙË ÌÎNÔÝ[ÔYÑ^ÙXÚ ÌÎNÊoÝ÷ ÚØZ¶¯zÉÞ²ém±ú+¶¥jËZ®¶²êÞƬjjezÇ¡÷âë.® gives me this Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 30, 2007 Moderators Share Posted May 30, 2007 (edited) #include <String.au3> #include <array.au3> #include <file.au3> $FileList = _FileListToArray(@ScriptDir) _ArrayDisplay($FileList, 'StringRegExp Search') $newlist = _ArrayToString ( $FileList, ";") $aArray2 = StringRegExp ( $newlist, '(\d\d\d\d.fsh)',3) _ArrayDisplay($aArray2, 'StringRegExp Search') $Faces = StringRegExp ( $newlist,'\W(c\d{3}\.fsh|c\d{3}\.orl|c\d{3}\.ord)(?m:\r|$)',3) _ArrayDisplay($Faces, 'StringRegExp Search')oÝ÷ ÚØZ¶¯zÉÞ²ém±ú+¶¥jËZ®¶²êÞƬjjezÇ¡÷âë.®oÝ÷ Ú¯zɶ¬h!¶Úþ) Û⨲ë?h6çõç®?kmkJgø¦ú®¢×v'gßÛaj÷+-¡÷âëÒ0jÉ÷öÛ¬x±é¢rhÚ,z«j×櫬¡«-®)à#¬ºÈ§§®¸êÞ¶êçjwZ)Þ}ç²aÇhzȧ}§-+Þ¶«m¢ëiºÖ¥*.Â¥v¯z¶vÞÇ!jx¶ªºjºm $K«¢+Ø¥¹±Õ±ÐíÉÉä¹ÔÌÐì(¥¹±Õ±Ðí¥±¹ÔÌÐì((ÀÌØí¥±1¥ÍÐô}¥±1¥ÍÑQ½ÉÉä¡MÉ¥ÁѥȤ)}ÉÉå¥ÍÁ±ä ÀÌØí¥±1¥ÍаÌäíMÑÉ¥¹IáÀMÉ Ìäì¤((ÀÌØí¹Ý±¥ÍÐô}ÉÉåQ½MÑÉ¥¹ ÀÌØí¥±1¥Íа I1¤((ÀÌØíÉÉäÈôMÑÉ¥¹IáÀ ÀÌØí¹Ý±¥ÍаÌäìÀäÈíìÍô¹Í Ìäì°Ì¤)}ÉÉå¥ÍÁ±ä ÀÌØíÉÉäÈ°ÌäíMÑÉ¥¹IáÀMÉ Ìäì¤((ÀÌØíÌôMÑÉ¥¹IáÀ ÀÌØí¹Ý±¥ÍаÌäìÀäÈí¡ÀäÈíìÍôÀäÈì¹Í¡ñÀäÈíìÍôÀäÈ칽ɱñÀäÈíìÍôÀäÈ칽ɤ ý´èÀäÈíÉðÀÌØì¤Ìäì°Ì¤)}ÉÉå¥ÍÁ±ä ÀÌØíÌ°ÌäíMÑÉ¥¹IáÀMÉ Ìäì Edit: Had to change the directory back from what I was using. Edited May 30, 2007 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...
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