Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Simple RegEX Question/Advice

Posted on 2002-07-25
4
Medium Priority
?
130 Views
Last Modified: 2010-05-02
I am trying to return a element in VB6 using regular expressions. The trouble is when I attempt to use
s = m("$1")I get nothing and s = m I get the entire match but not the element I want.

Perhaps a VB guru can tell me what is wrong with my syntax here:

---------------code---------------
Open "c:\test.htm" For Input As #1
  strText = Input(LOF(1), #1)
  Close #1

Set regEX = New RegExp
Dim s As String
Dim strtext As String
Dim m, matches

regEX.IgnoreCase = True
regEX.Global = True
regEX.MultiLine = True

regEX.Pattern = "window\.location.*?""(http://.*?)"""
Set matches = regEX.Execute(strText)


For Each m In matches
 If regEX.Test(m) Then
 s = m("$1")
 End If
Next

MsgBox s
0
Comment
Question by:James
  • 2
4 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7178727
You can also find this same question here:
What is wrong with this RegEx Expression? Date: 07/24/2002 09:17PM PST
http://www.experts-exchange.com/visualbasic/Q_20327647.html

Anthony
0
 

Author Comment

by:James
ID: 7178752
Also find no answer there too.......
0
 
LVL 2

Accepted Solution

by:
Biffo earned 400 total points
ID: 7178899
I just answered this with your other question. Is there any other questions you wanted me to answer? Leaving the office now so won't be till tomorrow till I can come back.

Chow
0
 

Author Comment

by:James
ID: 7178922
AWSOME.

P.S. if you get time I have more unanswered questions for you Biffo :-)
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question