Jump to content

Match start/end of string!


Recommended Posts

How to? Search for a string starting with "UBX" or "FLN" ends with @yahoo.com

what am I missing here?

;#include <Constants.au3>
;#include <Pacap.au3>
;#include <plug.au3>
$handle__    = FileOpenDialog('OpenScure', @WorkingDir & "\", "Pcap (*.cap;*.pcap;*.log)")
$IniWrite    = IniWrite("_config.ini", "SETUP", "key", $handle__)
$IniRead     = IniRead("_config.ini", "SETUP", "key", "")
;
$handle_read = FileOpen($IniRead, 0)
$SaveLog     = FileOpen("Results.log", 1)
;
If $handle_read <> -1 Then
    While 1
        $string = FileReadLine($handle_read)
        If @error Then ExitLoop
        $pcap = StringRegExp($string, 'UBX|FLN| (.*?)@yahoo.com\z', 3)
        For $i = 0 To UBound($pcap) - 1
            TrayTip("Results!", $pcap[$i], 15, 1)
            FileWrite($SaveLog, $pcap[$i] & @CRLF)
        Next
    WEnd
    FileClose($handle_read)
    FileClose($SaveLog)
Else
    MsgBox(0, '', 'File open error')
EndIf
Edited by DCCD
Link to comment
Share on other sites

have a try with this.

$Sorted_String = StringRegExp($String, "(?:UBX|FLN)(.*?)@yahoo.com", 3)

best place i'v found to learn Regular Expressions http://www.regular-expressions.info/tutorial.html

Edited by JackDinn

Thx all,Jack Dinn.

 

JD's Auto Internet Speed Tester

JD's Clip Catch (With Screen Shot Helper)

Projects :- AutoIt - My projects

My software never has bugs. It just develops random features. :-D

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