Solved

Simple RegEX Question/Advice

Posted on 2002-07-25
4
124 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

710 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