| How would i strip bad parts of code out of good tags? | |
|---|---|
| Tweet Topic Started: Aug 23 2009, 12:59 AM (428 Views) | |
| Knight13 | Aug 23 2009, 12:59 AM Post #1 |
|
0
Edited by Knight13, Mar 19 2010, 06:55 AM.
|
![]() |
|
| Darksorrow131 | Aug 24 2009, 10:07 PM Post #2 |
|
I have no clue what the standard way to do this kind of thing is... here are some ways I thought of, but none of them feel very good - convert ALL tags to HTML entities (<, >, and stuff), then regexp search for "</?(b|i|a|hr|img|blahblah)>" - regexp search all "<blahblah>", compare the tag with your list, and get rid of them if it's not in the list - get an HTML parser library somewhere but all of these methods feel pretty weird. |
|
(let loop () (loop)) ((lambda (x) (x x)) (lambda (x) (x x))) (let ((k #f)) (call/cc (lambda (cc) (set! k cc)) (k)) ((call/cc call/cc) (call/cc call/cc)) -- Infinite loops are awesome! -- Tell me if you have other awesome infinite loops! | |
![]() |
|
| cyrus709 | Feb 2 2010, 04:02 PM Post #3 |
|
I know that this thread is a bit old but as it has not been answered i will answer it Recently i have done something similar accept i used BB codes rather then actual html tags. I wrote the script myself and am proud to say it works well for me.1st) I strip the text of all html tags with strip_tags 2nd) I put on a word wrap (becouse of how my design is, there can only be so many words per line) 3rd) I user preg_replace to search the document for BB codes and replace the bb codes with html. 4th) I update my users profile text Here is my code that i used with comments to help you out
Basicly you need to look into str_replace preg_replace (for font color etc.) strip_tags |
| Therapy is expensive, poppin' bubble wrap is cheap! You choose. | |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Web-Based Programming Support · Next Topic » |






Recently i have done something similar accept i used BB codes rather then actual html tags. I wrote the script myself and am proud to say it works well for me.
10:18 AM Jul 11