From: Nigel M. <ora...@us...> - 2006-02-22 08:53:59
|
Update of /cvsroot/geshi/geshi-1.0.X/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19053/src Modified Files: geshi.php Log Message: Now using a simpler regex for numbers (Brice Bernard) Index: geshi.php =================================================================== RCS file: /cvsroot/geshi/geshi-1.0.X/src/geshi.php,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** geshi.php 21 Jan 2006 23:31:39 -0000 1.28 --- geshi.php 22 Feb 2006 08:53:56 -0000 1.29 *************** *** 2016,2023 **** // being highlighted twice (eg <span...><span...>5</span></span>) // Put /NUM!/ in for the styles, which gets replaced at the end. // if ($this->lexic_permissions['NUMBERS'] && preg_match('#[0-9]#', $stuff_to_parse )) { ! $stuff_to_parse = preg_replace('#([^a-zA-Z0-9_\#])([0-9]+)([^a-zA-Z0-9])#', "\\1<|/NUM!/>\\2|>\\3", $stuff_to_parse); ! $stuff_to_parse = preg_replace('#([^a-zA-Z0-9_\#>])([0-9]+)([^a-zA-Z0-9])#', "\\1<|/NUM!/>\\2|>\\3", $stuff_to_parse); } --- 2016,2028 ---- // being highlighted twice (eg <span...><span...>5</span></span>) // Put /NUM!/ in for the styles, which gets replaced at the end. + // + // NEW ONE: Brice Bernard + // $stuff_to_parse = preg_replace('/([^(\\w|#|\\\|"|\')])(\\d+)/', '\\1<|/NUM!/>\\2|>', $stuff_to_parse); + //$stuff_to_parse = preg_replace('/([-+]?\\b(?:[0-9]*\\.)?[0-9]+\\b)/', '<|/NUM!/>\\1|>', $stuff_to_parse); // if ($this->lexic_permissions['NUMBERS'] && preg_match('#[0-9]#', $stuff_to_parse )) { ! //$stuff_to_parse = preg_replace('#([^a-zA-Z0-9_\#])([0-9]+)([^a-zA-Z0-9])#', "\\1<|/NUM!/>\\2|>\\3", $stuff_to_parse); ! //$stuff_to_parse = preg_replace('#([^a-zA-Z0-9_\#>])([0-9]+)([^a-zA-Z0-9])#', "\\1<|/NUM!/>\\2|>\\3", $stuff_to_parse); ! $stuff_to_parse = preg_replace('/([-+]?\\b(?:[0-9]*\\.)?[0-9]+\\b)/', '<|/NUM!/>\\1|>', $stuff_to_parse); } |