|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Regex problemHi
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,
Show quote > Hi You need to escape the additional "s in your string. If I remember correctly > > 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 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 |
|||||||||||||||||||||||