Jump to content

Read line matching specific word


Recommended Posts

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

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 by MightyWeird
format
Link to comment
Share on other sites

  • Developers

So you just want the EXE filename when it contains beta.. like this? 

Local $aFound = StringRegExp($sText, "(?m)\S*beta\S*", 3)

 

Edited 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...