3
Contributors
6
Replies
9
Views
13 Years
Discussion Span
Last Post by Ragnarok
0

I'm not exactly sure of the PHP code to do this, but the algorithm might be for a string X, search the string until you detect "http://" ... from that on, it is a link until you reach whitespace. For each letter that isn't part of the URL, copy it directly into a new string X2. When you do detect a URL, add the appropriate code before and after it, and then copy it into X2. I think that might be a lot easier than inserting into the middle of the original string. I'm not sure how flexible php is with strings compared to C++ and Java, for example. Since it is a scripting language, however, I would assume it would natively be built to handle strings very well.

0

look at all the PHP functions avalable for doing something like this I have only found two that should work. They are preg_replace and eregi_replace but I only know the basics of how they work. for example

$text = preg_replace("#\[b\](.+?)\[/b\]#i","<b>\\1</b>",$text);

that would take what ever the value of text is and if it finds (in eather case) it will make the string that is inside bold.

I have looked at the PHP's preg syntaxs (sp) and I don't understand how they work well enough to know what to do.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.