MightyWeird Posted May 20, 2022 Share Posted May 20, 2022 Hi, I want to read the content of my webserver (containing files), but I only want to show the file with the name "beta") $filterexe1 = StringRegExp ($varFile, '(?:\.exe"\>)(.*)(?:\<\/a>)', 3) (filters .exe) global $content = _ArrayToString($filterexe1, "" & @LF, -1, -1, @CRLF, 2, 5) msgbox(0,"tst",$content) This gives me the following output: File1.exe file2beta.exe How do I fix this code so it only shows the line with "beta"? Link to comment Share on other sites More sharing options...
Developers Jos Posted May 20, 2022 Developers Share Posted May 20, 2022 Please post a runnable script which demonstrates the issue so we can run it an have a test/look. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MightyWeird Posted May 24, 2022 Author Share Posted May 24, 2022 (edited) Below a runnable script. (work in progress) I want to read the the string containing "beta" (in this case "testfile1beta.exe") #include <Array.au3> #include <MsgBoxConstants.au3> $sText = "not this line" & @CRLF & _ "not this line either" & @CRLF & _ "there might be some text before testfile1beta.exe i want this" & @CRLF & _ "testfile2.exe but not this want because is does not contain the matching word" ;~ Local $aFound = StringRegExp($sText, "(?im)beta\s*=\s*.*$", 3) ;Local $aFound = StringRegExp($sText, '(?:\.exe"\>)(.*)(?:\<\/a>)', 3) ("trying to filter .exe and then filter beta?") ;Local $aFound = StringRegExp($sText, "(?m)beta\s*=*.*$", 3) ;("kinda works, but prints the whole line and starts at beta. I need a space delimiter (or something)") Local $aFound = StringRegExp($sText, "(?m)beta.*$\s", 3) ;".*:(.*?)","$1") _ArrayDisplay($aFound, "", Default, 8) Edited May 24, 2022 by MightyWeird format Link to comment Share on other sites More sharing options...
Developers Jos Posted May 24, 2022 Developers Share Posted May 24, 2022 (edited) So you just want the EXE filename when it contains beta.. like this? Local $aFound = StringRegExp($sText, "(?m)\S*beta\S*", 3) Edited May 24, 2022 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MightyWeird Posted May 24, 2022 Author Share Posted May 24, 2022 Hi Jos, Yes, this wil work. I still have some special cases, but this put me in the right direction. Thank you. 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