logmein 3 Posted May 22, 2010 (edited) How can I use StringRegExp to detect this format of string: [Drive]\[Folder1]\[Folder2]\[...]\[Filename][.ext1][.ext2(exe, bat)] Sample paths : C:\British\SpitFire.html.exe C:\Luftwaffe\Stuka.txt.exe D:\Soviet\Sturmovik.doc.bat D:\USA\American\HawkerHurricane.backup.exe Thanks alot! Edited May 22, 2010 by logmein [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Share this post Link to post Share on other sites
JRowe 9 Posted May 22, 2010 (edited) your regular expression would be something like this:"(\w\:\\)(\w*\\+)*(\w+\.+\w+)*"First group is the drive, second group is the path, third group is the filename.You'll have to parse the path using stringexplode on the backslash "\" if you want to further break it down. Edited May 22, 2010 by JRowe [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Share this post Link to post Share on other sites
PsaltyDS 39 Posted May 22, 2010 (edited) Cause I'm tired and have to stay awake: #include <Array.au3> ; Only for _ArrayDisplay() Global $aStrings[4] = ["C:\British\SpitFire.html.exe", _ "C:\Luftwaffe\Stuka.txt.exe", _ "D:\Soviet\Sturmovik.doc.bat", _ "D:\USA\American\HawkerHurricane.backup.exe"] Global $sPatt = "(?i)([[:alpha:]]:)(?:\\)(.+)(?:\\)(.+\.(?:exe|bat)\Z)", $aRET For $n = 0 To UBound($aStrings) - 1 $aRET = StringRegExp($aStrings[$n], $sPatt, 3) If IsArray($aRET) Then _ArrayDisplay($aRET, $n & ": $aRET") Else ConsoleWrite($n & ": Failed: @error = " & @error & "; @extended = " & @extended & @LF) EndIf Next Edit: Forgot the alternative (exe|bat) Edited May 22, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites
logmein 3 Posted May 22, 2010 Thanks PsaltyDS! The program was solved! [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Share this post Link to post Share on other sites