Regexp cleaning
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Wed, 12 Jul 2006 13:04:37 +0000 (13:04 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:53 +0000 (00:34 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@83 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/misc.inc.php

index 6fb384c..2bb1905 100644 (file)
@@ -493,11 +493,8 @@ function formatbody($_text, $format='plain', $flowed=false)
         $formatting = Array('\*' => 'strong',
                             '_' => 'u',
                             '/' => 'em');
-        $word    = '-a-z0-9\'âäàãéêëêïîìöôòõüûùÿ';
         foreach ($formatting as $limit=>$mark) {
-            $res = preg_replace('@([^' . $word . '])'
-                                . $limit . '([' . $word . ']+)' . $limit 
-                                . '([^' . $word  . '])@i'
+            $res = preg_replace('@(\W)' . $limit . '(\w+)' . $limit . '(\W)@'
                                 ,'\1<' . $mark . '>\2</' . $mark . '>\3'
                                 , $res);
         }