Click here to Skip to main content
15,923,006 members
Home / Discussions / C#
   

C#

 
GeneralC# Memmory allocation Pin
zhyluo200330-Jun-03 6:30
zhyluo200330-Jun-03 6:30 
GeneralMatlab Application Pin
Ahmed Diaa30-Jun-03 6:24
Ahmed Diaa30-Jun-03 6:24 
GeneralActive Directory Searching Pin
soloforce30-Jun-03 6:18
soloforce30-Jun-03 6:18 
QuestionHow to make Key Logger? Pin
aMIR_bILAL30-Jun-03 5:41
aMIR_bILAL30-Jun-03 5:41 
GeneralLinkedLabel in Datagrid Pin
Chris#30-Jun-03 4:47
Chris#30-Jun-03 4:47 
QuestionColoring listview items? Pin
BoozeBomb30-Jun-03 4:41
BoozeBomb30-Jun-03 4:41 
AnswerRe: Coloring listview items? Pin
Roland Bär30-Jun-03 4:58
Roland Bär30-Jun-03 4:58 
GeneralNeed help with Regex Pin
viperxp30-Jun-03 4:15
viperxp30-Jun-03 4:15 
Hi...

I am doing an ad blocker in c#. The blocker will remove ads by stripping HTML tags that matches one or more keywords.

Example: these tags will (have to) be stripped...

<a href="http://myserver.com/mydir/ads/page.htm">Test link 1</a> ... [matches keyword '/ads']

<a href="http://myserver.com/mydir/page.htm"><img width=10 height=10 scr=adserve.myserver2.com/sponsor.gif> ... [matches 'adserve']

I am having problem coming up with regular expression pattern to give me the full matching tag, that is, like
<a href="http://myserver.com/mydir/ads/page.htm">Test link 1</a>
....when i am scanning for keyword '/ads'..
of coz the scanning is a loop, and the keyword is stored in a variable .. e.g. strKey.

the pattern : @"<a\s.*\shref=\S*", strKey, @"\S*(>|\s)"
doesnt work as it would return anything between the first "<a" (no qoutes) and the last space.

the pattern: @"href=\S*", strKey, @"\S*(>|\s)"
does not give the result i wanted.

I have tried to refer to MSDN, but things seem complex and beyond my understanding capability. I really hope someone

can help me to come up with the right regex pattern.

the tags i will (have to) examine include ... IMG SRC, A HREF, IFRAME SRC

thanks

GeneralRe: Need help with Regex Pin
leppie30-Jun-03 13:32
leppie30-Jun-03 13:32 
GeneralRe: Need help with Regex Pin
viperxp30-Jun-03 19:05
viperxp30-Jun-03 19:05 
GeneralRe: Need help with Regex Pin
1-Jul-03 5:22
suss1-Jul-03 5:22 
GeneralImage-Listbox Pin
jphuphilly30-Jun-03 4:13
jphuphilly30-Jun-03 4:13 
GeneralRe: Image-Listbox Pin
Manster30-Jun-03 9:03
Manster30-Jun-03 9:03 
GeneralRe: Image-Listbox Pin
jphuphilly30-Jun-03 11:08
jphuphilly30-Jun-03 11:08 
GeneralRe: Image-Listbox Pin
Manster1-Jul-03 3:59
Manster1-Jul-03 3:59 
GeneralRe: Image-Listbox Pin
jphuphilly1-Jul-03 7:27
jphuphilly1-Jul-03 7:27 
GeneralRe: Image-Listbox Pin
jphuphilly30-Jun-03 11:35
jphuphilly30-Jun-03 11:35 
Questionwho knows sth. about FolderNameEditor? Pin
gongxiancao30-Jun-03 2:48
gongxiancao30-Jun-03 2:48 
GeneralToolbars, main menus &amp; context menus Pin
hbandarra29-Jun-03 23:48
hbandarra29-Jun-03 23:48 
GeneralRe: Toolbars, main menus &amp; context menus Pin
hbandarra30-Jun-03 3:19
hbandarra30-Jun-03 3:19 
GeneralDeserializing dynamically loaded types Pin
Oyvind Bratland29-Jun-03 22:26
Oyvind Bratland29-Jun-03 22:26 
Generalopacity of panels Pin
Member 138827529-Jun-03 21:39
Member 138827529-Jun-03 21:39 
QuestionSerialize into the appropriate App.exe.config file? Pin
Anonymous29-Jun-03 17:59
Anonymous29-Jun-03 17:59 
GeneralKeyword.... Pin
Steve McLenithan28-Jun-03 17:41
Steve McLenithan28-Jun-03 17:41 
GeneralRe: Keyword.... Pin
Bo Hunter28-Jun-03 18:19
Bo Hunter28-Jun-03 18:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.