Jump to content

Regex help


Recommended Posts

Hey everyone. I am parsing through a file, a web page specifically, and I am trying to figure out how to match something like:

*****************malloc***************.exe***************

where * means any character of any amount. I basically want to return true if the line contains malloc blah .exe. I have never done any regex before, and I am completely confused. I've been playing around with the tutorial page for quite a while, to no avail. If someone could help me out, I would really appreciate it. What I have right now is:

$match = StringRegExp($line, "\Amalloc(?x).exe", 2)
If @error = 0 Then
    For $i = 0 to UBound($match) - 1
        MsgBox(0, "test", $match[$i])
    Next
EndIf
Link to comment
Share on other sites

Hey everyone. I am parsing through a file, a web page specifically, and I am trying to figure out how to match something like:

*****************malloc***************.exe***************

where * means any character of any amount. I basically want to return true if the line contains malloc blah .exe. I have never done any regex before, and I am completely confused. I've been playing around with the tutorial page for quite a while, to no avail. If someone could help me out, I would really appreciate it. What I have right now is:

$match = StringRegExp($line, "\Amalloc(?x).exe", 2)
If @error = 0 Then
    For $i = 0 to UBound($match) - 1
        MsgBox(0, "test", $match[$i])
    Next
EndIf
In autoit3 there is a programm to test an expression with regexp Try it it's really welldone and i think you find your solution.
Link to comment
Share on other sites

Hi,

you mean:

Global $text[3] = ['wrewq', '*****************malloc***************.exe***************', 'wefr32f23fmalloc ex']

For $i = 0 To UBound($text) - 1
    If StringRegExp($text[$i], "malloc.*\.exe", 0) Then MsgBox(0, "Matched", $text[$i])
Next

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...