PDA

View Full Version : php question


jdleung
03-30-2007, 08:22 AM
if there is a line in comment

"great shot, please visit <a href="www.xxx.com">mycc.com</a> for more infomation."

is it possible to delete only "<a href="www.xxx.com">mycc.com</a>"? and keep others.

Dennis
03-30-2007, 09:33 AM
Yeah that is possible, but if the url is either in a blacklist or DSBL list, the comment is rejected because it is a spam comment. Spammers tend to find every shot a great shot. ;)

jdleung
03-30-2007, 09:45 AM
schonhose, I meant how to write the codes but not pixelpost's function.

thanks.;=)

GeoS
03-30-2007, 04:32 PM
Read i.e. about preg_replace or ereg_replace functions. They are based on regular expressions thanks to which you need to know only pattern for such part of comments.

jdleung
03-30-2007, 05:16 PM
GeoS, I'm confused on using two functions. can it clear whole line "<a href="www.xxx.com">mycc.com</a>", I mean including "www.xxx.com" and "mycc.com", but they are variables. can it?

if it can, would you please write an simple example for me?

thanks.

GeoS
03-31-2007, 12:10 AM
It should be useful for many of our users:
http://regexlib.com/DisplayPatterns.aspx

jdleung
03-31-2007, 01:11 PM
WOW. it's great! GeoS. it took me some time to understand, but it works!

austriaka
03-31-2007, 02:24 PM
and to learn the basics about regular expressions have a look here:
http://www.regenechsen.de/phpwcms/index.php?regex_englisch
(don't be bothered because it points to an email client, the basics are the same)
:-)

KArin

jdleung
04-01-2007, 01:22 AM
thanks, KArin.