Regex problem

  • Thread starter Thread starter Barry
  • Start date Start date
B

Barry

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
 
Hello Barry,
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&sit
e=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

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\('([^']+)'\)
 
Back
Top