htcilt
03-01-2010, 10:19 AM
I've never quite figured out regular expressions. Does anyone know how to strips out all html except <p> and <em>?
|
||||
Remove all html tags except <p> and <em>htcilt 03-01-2010, 10:19 AM I've never quite figured out regular expressions. Does anyone know how to strips out all html except <p> and <em>? Dormilich 03-01-2010, 10:32 AM I’d rather convert them to something like BBCode run strip_tags() and undo the tag masking. htcilt 03-01-2010, 10:39 AM The problem there is I'm trying to remove MS Word formatting at the same time. Because there are styles in the paragraph tag e.g.: <P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"> So I'm not sure how to strip out everything and leave <p>'s and <em>'s? JAY6390 03-01-2010, 11:31 AM '%<(p|em)\b[^>]*>.*?</\1>%i' That will match all p and em tags for you kbluhm 03-01-2010, 12:58 PM strip_tags( $html, '<p><em>' ); |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum