klenwell information services : PhpRegexRepository

PHP Regex Repository

A collection of regular expression: canonical (tested with common practical applications), special cases, and developmental

Canonical

 


Special Cases

 


Developmental

// pipes should be padded with 1 (and only 1!) space on each side
if ( 1 )
{
    $str = 'xx|xx | av | a asd| asd |xxx | abc';
    echo "<pre>$str</pre>";
    $r = str_replace('|', ' | ', $str);
    $r = preg_replace('%\s+%', ' ', $r);
    $r = str_replace(' ','%',$r);
    echo "<pre>$r</pre>";
}


Sandbox

 




CategoryPhp