473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Regular Expressions problem

I am trying to turn my html page into text only (except for <atags -
links).

I have changed everything except remaining tags.
************************************
// Remove remaining tags like <a>, links, images,
// comments etc - anything thats enclosed inside < >

result = System.Text.RegularExpressions.Regex.Replace(resul t,
@"<[^>]*>",string.Empty,
System.Text.RegularExpressions.RegexOptions.Ignore Case);
***********************************************

Is there a way to change this to say all tags EXCEPT <atags?

Thanks,

Tom
Feb 7 '07 #1
2 1093
I think your Regex should be this: @"<[^aA>].*?>"
but it will replace the </Atags too

hope it is useful:)

"tshad" <t@home.comwrote in message
news:uE**************@TK2MSFTNGP04.phx.gbl...
>I am trying to turn my html page into text only (except for <atags -
links).

I have changed everything except remaining tags.
************************************
// Remove remaining tags like <a>, links, images,
// comments etc - anything thats enclosed inside < >

result = System.Text.RegularExpressions.Regex.Replace(resul t,
@"<[^>]*>",string.Empty,
System.Text.RegularExpressions.RegexOptions.Ignore Case);
***********************************************

Is there a way to change this to say all tags EXCEPT <atags?

Thanks,

Tom
Feb 8 '07 #2
Here is the working Regex string:
@"<[^aA>/].*?[^aA]?>|</[^aA]>|</[b-zB-Z0-9].*?>"

"tshad" <t@home.comwrote in message
news:uE**************@TK2MSFTNGP04.phx.gbl...
>I am trying to turn my html page into text only (except for <atags -
links).

I have changed everything except remaining tags.
************************************
// Remove remaining tags like <a>, links, images,
// comments etc - anything thats enclosed inside < >

result = System.Text.RegularExpressions.Regex.Replace(resul t,
@"<[^>]*>",string.Empty,
System.Text.RegularExpressions.RegexOptions.Ignore Case);
***********************************************

Is there a way to change this to say all tags EXCEPT <atags?

Thanks,

Tom
Feb 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Michael McGarry | last post by:
Hi, I am horrible with Regular Expressions, can anyone recommend a book on it? Also I am trying to parse the following string to extract the number after load average. ".... load average:...
11
by: Martin Robins | last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being...
3
by: Mark | last post by:
I'm having trouble creating a regular expression to parse bits of data from a string and was hoping someone could lead me in the right direction. Consider the following string 423456 Victor...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
9
by: Pete Davis | last post by:
I'm using regular expressions to extract some data and some links from some web pages. I download the page and then I want to get a list of certain links. For building regular expressions, I use...
3
by: LordHog | last post by:
Hello all, I am attempting to create a small scripting application to be used during testing. I extract the commands from the script file I was going to tokenize the each line as one of the...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
5
by: teo | last post by:
I need to implement a boolean evaluation in a Regular Expression like this: (aaa AND bbb) OR (ccc AND ddd) (see the #3 case) - - - 1) If I need to match a single word only,
12
by: FAQEditor | last post by:
Anybody have any URL's to tutorials and/or references for Regular Expressions? The four I have so far are: http://docs.sun.com/source/816-6408-10/regexp.htm...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.