Solved

Simple RegEX Question/Advice

Posted on 2002-07-25
4
120 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now