Groups | Blog | Home
all groups > dotnet framework > october 2007 >

dotnet framework : Regex problem


Barry
10/31/2007 8:14:06 PM
Hi

I need to capture

/contract_info/index.asp?action=Delete&site=DB&id=17016852

from

dim s as string = "<a
href="javascript:NewWindow('/contract_info/index.asp?action=Delete&site=DB&id=17016852')">Details</a>"

Dim mtch As Match = Regex.Matches(s, """javascript:NewWindow((.*?)",
RegexOptions.Singleline Or RegexOptions.IgnoreCase)


Note: compiler will create problem on the 1st line ie dims as string =???
TIA

Jesse Houwing
10/31/2007 8:50:23 PM
Hello Barry,

[quoted text, click to view]

You need to escape the additional "s in your string. If I remember correctly
you do that by doubling the "s to make it:

dim s as string = "<a href=""javascript:NewWindow('/contract_info/index.asp?action=Delete&site=DB&id=17016852')"">Details</a>"

The reges would be what you've created, or more exactly:

NewWindow\('([^']+)'\)

--
Jesse Houwing
jesse.houwing at sogeti.nl

AddThis Social Bookmark Button