Re: [VB.NET express 2005] - Regular expressions
- From: Movie Maniac® <isotopiPUSSAVIABRUTTOSPIDER@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 15 Jan 2006 01:01:35 +0100
Homer J Simpson ha scritto:
"Movie Maniac®" <isotopiPUSSAVIABRUTTOSPIDER@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:43c8f248$0$1085$4fafbaef@xxxxxxxxxxxxxxxxxxxxxx
But, how can I retrieve only those img tag containing the 'edit' string? I know this is more a matter of reg_exp, but hope someone can help :)
Can you post a couple of lines?
a couple of lines of what? Of VB code? of html code?
well, as for VB, here you go:
Private Function findImgTags(ByVal strHTML As String) As Object
'Returns the img tag we are searching
Dim Match = Regex.Matches(strHTML, "<img[^>]*>", RegexOptions.IgnoreCase)
Dim str As Object
Dim a As String
For Each str In Match
a = str.ToString()
If InStr(a, "edit", CompareMethod.Text) Then Return a
Next
Return False
End Functionwhile if you meant html code, well imagine an html page with a serie of images, like this:
<img src="image1.gif" title="join"> <img src="image1.gif" title="leave"> <img src="image1.gif" title="add"> <img src="image1.gif" title="edit"> <img src="image1.gif" title="delete">
I would like to retrieve just the last one. As you can see, I retrieve all the images, and then do a loop on the object to find the right one. But I know I can avoid this with the proper regular expression.
The question is: how can I do?
Thanks a lot .
- Follow-Ups:
- Re: [VB.NET express 2005] - Regular expressions
- From: Homer J Simpson
- Re: [VB.NET express 2005] - Regular expressions
- References:
- [VB.NET express 2005] - Regular expressions
- From: Movie Maniac®
- Re: [VB.NET express 2005] - Regular expressions
- From: Herfried K. Wagner [MVP]
- Re: [VB.NET express 2005] - Regular expressions
- From: Movie Maniac®
- Re: [VB.NET express 2005] - Regular expressions
- From: Homer J Simpson
- [VB.NET express 2005] - Regular expressions
- Prev by Date: Re: How to send an Email in VB.NET
- Next by Date: Problems with Datagrid with a tables Styles Tablestyles
- Previous by thread: Re: [VB.NET express 2005] - Regular expressions
- Next by thread: Re: [VB.NET express 2005] - Regular expressions
- Index(es):