I'm trying to make a BB Code script, setting the Bold, Italic, URL etc is easy enought but how do you make it scan for rogue links that aren't placed in a URL tag and same goes for email because I just can't get it to work.
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.
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