Page 1 of 1

find two option but dont repeat

Posted: Mon Nov 27, 2006 10:28 am
by visonardo
i need test if the address works in a site, may be that these urls are writen simple like (without *) *http://domine.some/folder/file.extention
or thus <a href="url">url</a>

the problem is that in some cases the links are thus <a href="url">word!=url</a> if i find some <a href="url"> i replace it by the same but then of href=url> an image red or green depending if that work (the url), then if i search that are simplely wroten as i shown first may be that i find again the same url but between a tags and put again the image, and in this case would has two time the image, it would appear thus ImageImagehttp://url.some

and i dont want thus, my regex is it

Code: Select all

$tutu=preg_replace_callback("/((<\s*a\s+[^>]*href\s*=\s*(((\"|'|`)".$value[0]."\\5)|(".$value[0]."))[^>]*>)|(".$value[0]."))/i","bot",$tutu);
how i would do to fix that?

Posted: Mon Nov 27, 2006 1:42 pm
by feyd
I can't understand what you're asking about.

Posted: Mon Nov 27, 2006 2:04 pm
by GeertDD
Yeah, some proper punctuation wouldn't do any harm. I don't completely get what you mean to say neither. A few notes already though.

Where does $value[0] come from? I guess it contains a url, or the regex for a url?

Also note that if your regex subject contained valid html (e.g. quotes around the attribute values), you could simplify the current regex already.