Nail Salons - Loans - Mortgage - Car Credit - Loans

PDA

View Full Version : Keep formatting but paste without hyperlinks


dastuff
Aug 4th 2006, 5:49 pm
Hi all,

I'm looking for some sort of "paste special" that keeps the formatting such as <h3>, <b> , whatever, but dehyperlinks all the links... I want the text to stay there but don't want it to point to the hyperlink anymore.

The reason is because I want to copy a couple wiki articles for certain explanations on my website, but I don't want all the broken wiki links going with it... I'd like to keep the syntax though.

Don't worry though I am citing and linking back to the wiki article at the bottom. :) Don't want to steal someone else's work.

Thanks,

Dastuff

ps. I notice that when I paste into wordpad it takes out the hyperlinks.. but it also loses the formatting :(

danielbruzual
Aug 4th 2006, 6:34 pm
You should be able to do it in php with preg_replace(). You should consider asking a programmer since it is not very easy to write the patterns.

dastuff
Aug 4th 2006, 10:07 pm
What is a preg_replace?

Does anyone know of any other programs that are able to do this or is it basically as a programmer? The problem with a preg_replace I would think is I don't want to get rid fo all the links on the page but rather just the wiki ones... Any additional help would be appreciated.

Thanks.

danielbruzual
Aug 5th 2006, 5:12 am
preg_replace is a php function that allows you to replace text that matches a predefined pattern in a string.

I am not a programmer but the best I could come up with is to come up with some function (in php) that does this:

Check all the text (the string you parse to the function) and see if a link is internal or if it belongs to the wiki.
If it is internal or links to a page other than the wiki's, leave it as is.
If it links to the wiki delete the link and leave only the anchor(using regular expressions (http://www.freelancevolunteer.com/php_tutorials/reg_exp.php))
Return modified text.