Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple RegEX Question/Advice

Posted on 2002-07-25
4
Medium Priority
?
128 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
[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: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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

688 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