View Single Post
sexdwarf sexdwarf is offline 2002-08-07 #2 Old  
going to bed so my reply is short and sweet, maybe a little fluff and whip cream, but no cherries on top tonight...

1) are you trying to strip the slashes? in that case look into stripslashes

2) perl allways has and allways is my favorite, so when it comes down to things that will involve regular expressions in php i allways have a few problems because i am so used to the perl method...and as stated before, i am tired and need to go to bed, so instead of giving you the php answer, here is how you do it in perl, and you can try to convert it to php...if you can't i can convert it for you tomorrow:
Code:
#!/usr/bin/perl
$thetext = "go to [LINK]http://www.ultrashock.com/[/link]";
$thetext =~ s/\[LINK\](.*?)\[\/LINK\]/<a href="$1">$1<\/a>/gi;
print $thetext."\n";
or you can extend the code to allow for link name by doing:
Code:
#!/usr/bin/perl
$thetext = "go to ultrashock!";
$thetext =~ s/\(.*?)\[\/LINK\]/<a href="$1">$2<\/a>/gi;
print $thetext."\n";


and you can also just combine the two:

Code:
";
$thetext =~ s/\[link=(.*?)\](.*?)\[\/LINK\]/<a href="$1">$2<\/a>/gi;
$thetext =~ s/\[LINK\](.*?)\[\/LINK\]/<a href="$1">$1<\/a>/gi;
print $thetext."\n";
hope this helps you...let me know if you need help with the php conversion...but it shouldn't be that hard...mgiht be fun for someone out there to do (or maybe i am just too much of a geek to think it's fun to try and convert regular expressions..........)
Reply With Quote