If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Regular Expressions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-09-03, 18:38
rhs98 rhs98 is offline
Super Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
Posts: 441
Smile Regular Expressions

I got bored today and started playing with the regex object - that is the object which deals with regular expressions.

I wrote a couple of expressions to remove font tags from posts;
Code:
(<font[^>]*>|<(/)+em>)
and found this one; which removes all html content (but leaves < and > that are elsewhere in the string)
Code:
(<(.|\n)+?>|')
and the code used to run it;
Code:
Function stripHTML(strHTML)
'Strips the HTML tags from strHTML
  Dim objRegExp, strOutput
  Set objRegExp = New Regexp
  objRegExp.IgnoreCase = True
  objRegExp.Global = True

  objRegExp.Pattern = "(<(.|\n)+?>|')"
  strOutput = objRegExp.Replace(strHTML, "")
  
  stripHTML = strOutput    'Return the value of strOutput
  Set objRegExp = Nothing
End Function
Anyway, thought someone might find this useful, as well as these links;
http://www.google.com/search?hl=en&l...utorial+-forum
http://www.4guysfromrolla.com/webtech/090199-1.shtml
http://www.4guysfromrolla.com/webtech/031500-1.shtml

Currently I am making the page where users insert news from more integilent; images will be sized sensibly, dead ones removed, and local copies got (GET). This will hopefully stop the news page looking a mess!
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On