HighTechTalks DotNet Forums  

Regex problem

Dotnet Framework microsoft.public.dotnet.framework


Discuss Regex problem in the Dotnet Framework forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Barry
 
Posts: n/a

Default Regex problem - 10-31-2007 , 10:44 AM






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')">Det ails</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



Reply With Quote
  #2  
Old   
Jesse Houwing
 
Posts: n/a

Default Re: Regex problem - 10-31-2007 , 04:50 PM






Hello Barry,

Quote:
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')"">De tails</a>"

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

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

--
Jesse Houwing
jesse.houwing at sogeti.nl




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.