Location: PHPKode > scripts > Regexp store > regexp_store_example.php
<?
mysql_connect('localhost','root','') or halt_error(mysql_error());
mysql_select_db('test') or halt_error(mysql_error());
mysql_query("SET NAMES utf8");

require('regexp_store.class.php');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<title>REGEXP STORE EXAMPLE</title>
</head>
<body>

<?
function show_result($a)
{
    return highlight_string(var_export($a,true),true);
}

$s = '1 kg / 2 m , 3 l; 2 USD, 24 cm';
echo '$s<br>'.show_result($s).'<br>';
$oRS = new regexp_store('regexp_store_test');

$s1 = $oRS->preg_replace('digits','',$s);
echo '$oRS->preg_replace(digits,,$s)<br>'.show_result($s1).'<br>';

$s2 = $oRS->preg_replace('digits','one',$s);
echo '$oRS->preg_replace(digits,one,$s)<br>'.show_result($s2).'<br>';


$a1 = $oRS->preg_split('delimiters','',$s);
echo '$oRS->preg_split(delimiters,,$s)<br>'.show_result($a1).'<br>';

$a2 = $oRS->preg_match('units','length',$s);
echo '$oRS->preg_match(units,length,$s)<br>'.show_result($a2).'<br>';

$a3 = $oRS->preg_match_all('units','all',$s);
echo '$oRS->preg_match_all(units,,$s)<br>'.show_result($a3).'<br>';

$a4 = $oRS->preg_split('delimiters','',$s);
echo '$oRS->preg_split(delimiters,,$s)<br>'.show_result($a4).'<br>';

$a4 = $oRS->preg_split_capture_delim('delimiters','',$s);
echo '$oRS->preg_split_capture_delim(delimiters,,$s)<br>'.show_result($a4).'<br>';


?>
</body>
</html>
Return current item: Regexp store