Jump to content
Sign in to follow this  
jinbaba

RegEx - Matching starting element

Recommended Posts

jinbaba

Hello Folks,

I want to write a regex that finds if the given string starts and ends with character " (double qoute)

e.g.

If string is "***" then

Return True

Else

; Do something else.

I wrote small code

Local $Pcap = '"E:\edonkey.pcap"'
Local $retVal = StringRegExp($Pcap, '"\S+"', 0)

;Local $retVal = StringRegExp($Pcap, '\S+"', 0)

MsgBox(0, "Search Result", "Return value is: " & $retVal)

The problem is, it always returns 0 (no match). But if I remove the double qoute char at beginning of regex it works. As done in commented line.

The question is why it is not matching initial double qoute. I tried escaping ", but it didn't worked.

Any help in resolving this issue.

Thanx

Jinbaba

Edited by jinbaba

Share this post


Link to post
Share on other sites
Armand

there is no capture group... try this:

Local $Pcap = '"E:\edonkey.pcap"'
Local $retVal = StringRegExp($Pcap, '"(\S+)"', 0)
MsgBox(0, "Search Result", "Return value is: " & $retVal)

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
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
Sign in to follow this  

×