Solved

Simple RegEX Question/Advice

Posted on 2002-07-25
4
123 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:ohmeohmy
  • 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:ohmeohmy
ID: 7178752
Also find no answer there too.......
0
 
LVL 2

Accepted Solution

by:
Biffo earned 100 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:ohmeohmy
ID: 7178922
AWSOME.

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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

828 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