Dear List,

Iīm writing a little framework with special features for my application. The
content of my Website is in HTML-Pages from other users working with
HTML-Editors.

I parse the content in their <body> in my framework.

now I have to replace the content of their links from <a
href="test.html">test</a> to <a href="index.php?page=test.html">test</a>. It
works fine with the following replacement.

$body2 = preg_replace('/href="(.*?)"/i', 'href="index.php?page=$1"', $body);

But if the content of their hrefīs is an external link (http:// at
beginning) or a javascript-link (javascript: at beginning) I donīt want to
do that.

With (?<!http:\/\/) before a word I can say, if there is an http:// in front
of, donīt replace. But it works only if I know the content of the link...
like this.

$body1 = preg_replace('/href="(?<!http:\/\/)www.test.com"/i',
'href="index.php?page=internal"', $body);

I canīt figure out how to combine the two replacements to work...

do you have any sugesstion? thanks for your help.

christoph

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to