<form action="" method="get">
Data: <input type="text" name="data" maxlength="64" size="64"/><br/>
Regexp: <input type="text" name="regexp" maxlength="64" size="64"/><br/>
<input type="submit"/>
</form>
<?php
$filter = FILTER_VALIDATE_REGEXP;
if (!empty($_GET['regexp']))
$options = array( 'options' =>
array( 'regexp' => $_GET['regexp'] ) );
if (isset($_GET['data'])) {
$data = filter_input( INPUT_GET, 'data', $filter, $options );
var_dump( $data );
}
?>
Output