Page 1 of 1

PHP tags dislike regular expression syntax...

Posted: Mon Jun 12, 2006 10:22 am
by Maugrim_The_Reaper

Code: Select all

<?php

$string = 'http://www.mydomain.com/index.php?st=1';
echo preg_replace('/[^[:alnum:].]/', '_', $string); //http___www.mydomain.com_index.php_st_1

?>
When put between php tags removes the :alnum: range in regex like so...

Code: Select all

<?php

$string = 'http://www.mydomain.com/index.php?st=1';
echo preg_replace('/[^[].]/', '_', $string); //http___www.mydomain.com_index.php_st_1

?>

Posted: Mon Jun 12, 2006 10:38 am
by John Cartwright
I would love to find a syntax highlighter that doesn't have any bugs :(

Posted: Mon Jun 12, 2006 10:59 am
by Maugrim_The_Reaper
+1 :) Sorry to be the bearer of buggy news...

Posted: Mon Jun 12, 2006 12:48 pm
by Chris Corbyn
I have to admit, that syntax highlighter seems to have been a bad move at least for the

Code: Select all

 tags.  Perhaps it will be rolled back at the next upgrade.

Posted: Mon Jun 12, 2006 4:13 pm
by Maugrim_The_Reaper
I wouldn't say it's a lost cause - we probably exercise it to a whole new level seeing as Devnetwork is one of those all you can eat PHP help buffets...

Posted: Mon Jun 12, 2006 4:16 pm
by RobertGonzalez
And I would say that for the most part it has been a useful tool, even for seasoned developers that see the code they posted and immediately saw something that broke the higlighter and knew right away what the problem was.

I agree it'd be nice to have one that works, but I am still happy with the one we got.

Posted: Mon Jun 12, 2006 4:17 pm
by Chris Corbyn
Maugrim_The_Reaper wrote:I wouldn't say it's a lost cause - we probably exercise it to a whole new level seeing as Devnetwork is one of those all you can eat PHP help buffets...
True :) Geshi by itself works nicely. It's when you mix it with PHPBB's bbcode.php mod that it all starts to go pear shaped. There's pre/post -processing on the data so things get interefered with that should be.