|
-
Apr 2nd, 2001, 12:25 PM
#1
Thread Starter
Addicted Member
Anybody know how to go about removing all html from user entered text?
-
Apr 2nd, 2001, 12:47 PM
#2
How is the user to enter this ?
You could use vb's replace function if it's small :
Code:
REPLACE "<HTML>", text1.text, ""
Or are you looking at a whole web page type thing ???
-
Apr 2nd, 2001, 12:51 PM
#3
Thread Starter
Addicted Member
I could but the I would have to write a rplace for every html tag and then parse the text looking for hrefs,img,form... since the tags vary. I was hoping there was a better way to do it
-
Apr 2nd, 2001, 01:30 PM
#4
Black Cat
Just convert the < and > to > and <
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Apr 4th, 2001, 02:13 AM
#5
J, awkward but I think needed. If you could give me an example of what this is for / the context you need this for would help.
Josh, that would still keep :
HTML from :
<HTML>
so he would get a load of extra words in his text.
What you could do is use an array for all the tags, something like :
Code:
Dim ArrTag(5) as variant
'Note : Arrays always start at 0, so me declaring a scope
of 5 spaces here really gives 6 - 0,1,2,3,4 and 5
ArrTag = Array(<HTML>, <HEAD>, <BODY>, <SCRIPT>, <TABLE>, <TR>, <TD>)
So you only type them once, put each tag into an array
For i = 0 to ubound(ArrTag)
'Go through all the array until the bottom entry is reached
Replace ArrTag(i), Text1.text, ""
' change the tag with a blank space
Next i
-
Apr 4th, 2001, 11:19 AM
#6
Black Cat
VBScript supports regular expressions now, right? I have some Perl code somewhere I wrote a couple years ago that will strip HTML tags from user text. What it basically would do is to find < and the next >, and strip them and everything in between.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|