[thelist] Regular Expressions

Norman Beresford n.beresford at anansi.co.uk
Thu Feb 22 03:25:28 CST 2001


Hi all

I'm having real trouble getting a regular expression thing to work in
VBScript and I was wondering if anyone could figure out what is
going wrong.

The error message I'm getting is:

 Microsoft VBScript runtime error '800a139a'
Unexpected quantifier

/Anansi/htdocs/staff/norman/dev/spider/reg_test.asp, line 38



The code I'm trying to get working is:

<%

sHTML = _
"<B><A
HREF='http://www.moneyunlimited.co.uk/Distribution/Redirect_Artifact/0,4678,
0-440810,00.html'>Halifax goes all out for home loan
dominance</A></B><BR><B>21 February: </B>The battle for Britain's mortgage
customers intensified yesterday as Halifax announced what it claimed was the
most competitive range of products on the market and published plans to grab
15% of all new home loans in 2001. <BR></font><BR>This item = <font
size=""2"" face=""Geneva,Arial,sans-serif""><B><A
HREF='http://www.moneyunlimited.co.uk/Distribution/Redirect_Artifact/0,4678,
0-440827,00.html'>Bank lays a ghost to rest</A>"

Set rWorldPop = New regexp
rWorldPop.Pattern = "<a .*?>.*?<\/a>"
rWorldPop.Global = True
rWorldPop.IgnoreCase = True
'Execute the regular expression on the raw HTML
Set objCols = rWorldPop.Execute( sHTML )


'Step through our matches
For Each objMatch in objCols
 response.write "Match<br>" & objMatch.Value & "<BR>End Match<br>"
Next

'Clean up
Set rWorldPop = Nothing
Set objCols = Nothing

%>

I guess from the error message that the problem is with the expression
itself ( "<a .*?>.*?<\/a>") but I must admit to a huge lack of knowledge
about them so I can't spot if something is obviously wrong with it.

Any help would be massively appreciated

Norman







More information about the thelist mailing list