Forum Moderators: coopster

Message Too Old, No Replies

regular expressions

html

         

bootsboard

7:44 pm on Jul 20, 2003 (gmt 0)



I'm one that avoids them like the plague.

Here a question
This expression removes everything between, including the <> in HTML "<[^>]*>" However I want everthing between the <> which contains mailto: or http: to remain, is this possible with regular expressions. Might be a stupid question but I have just started using them, Finding them a bit hard at the moment. I.e how to you add expressions. like

search text for string1, string2 and string3 etc

regards clive homewood

vincevincevince

8:28 pm on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



welcome!

preg_replace("/\<[^\>]*\>/","",preg_replace("/\<([^\>]*mailto:[^\>]*)\>/","[$1]",preg_replace("/\<([^\>]*http:[^\>]*)\>/","[$1]","$text")));

try that?

vincevincevince

11:36 am on Jul 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




preg_replace("/\<[^\>]*\>/","",preg_replace("/\<([^\>]*mailto:[^\>]*)\>/i","[$1]",preg_replace("/\<([^\>]*http:[^\>]*)\>/","[$1]","$text")));

just a wee change to make it case insensitive :)