Fork me on GitHub

Comment by Otomatic (2013-04-18 08:25:32)

Edited by Otomatic (2013-04-18 08:26:41)

 1:  1:
 Hi, Hi,
  
 Function ucp_preg_replace modified: Function ucp_preg_replace modified:
 [code]  [code]
 //  //
 // Replace string matching regular expression  // Replace string matching regular expression
 //  //
 // This function takes care of possibly disabled unicode properties in PCRE builds  // This function takes care of possibly disabled unicode properties in PCRE builds
 // [modif oto] - Added $callback parameter to use preg_replace_callback  // [modif oto] - Added $callback parameter to use preg_replace_callback
 // in place of preg_replace with modifier "e" on pattern  // in place of preg_replace with modifier "e" on pattern
 function ucp_preg_replace($pattern, $replace, $subject, $callback = false)  function ucp_preg_replace($pattern, $replace, $subject, $callback = false)
 {  {
  if($callback)   if($callback)
  $replaced = preg_replace_callback($pattern, create_function('$matches', 'return '.$replace.';'), $subject);   $replaced = preg_replace_callback($pattern, create_function('$matches', 'return '.$replace.';'), $subject);
  else   else
  $replaced = preg_replace($pattern, $replace, $subject);   $replaced = preg_replace($pattern, $replace, $subject);
   
  // If preg_replace() returns false, this probably means unicode support is not built-in, so we need to modify the pattern a little   // If preg_replace() returns false, this probably means unicode support is not built-in, so we need to modify the pattern a little
  if ($replaced === false)   if ($replaced === false)
  {   {
  if (is_array($pattern))   if (is_array($pattern))
  {   {
  foreach ($pattern as $cur_key => $cur_pattern)   foreach ($pattern as $cur_key => $cur_pattern)
  $pattern[$cur_key] = str_replace('\p{L}\p{N}', '\w', $cur_pattern);   $pattern[$cur_key] = str_replace('\p{L}\p{N}', '\w', $cur_pattern);
   
  $replaced = preg_replace($pattern, $replace, $subject);   $replaced = preg_replace($pattern, $replace, $subject);
  }   }
  else   else
  $replaced = preg_replace(str_replace('\p{L}\p{N}', '\w', $pattern), $replace, $subject);   $replaced = preg_replace(str_replace('\p{L}\p{N}', '\w', $pattern), $replace, $subject);
  }   }
   
  return $replaced;   return $replaced;
 }  }
-And a .diff file for parser.php. I generate this file whith winmerge on Windows 7 Pro 64 bits.  
-I hope it is correct.  
-  
 [/code] [/code]
 +And a .diff file for parser.php. I generate this file whith winmerge on Windows 7 Pro 64 bits.
 +I hope it is correct.