Hi all,
I have a problem for sanitizing / validating a web address input.
My personal favor is doing it with regex.
I made a simple example with preg_replace
<?php
if (!empty($_POST['wbddrss']) ) {
$wbddrss = $_POST['wbddrss'];
$wbddrss = trim($wbddrss);
var_dump($wbddrss);
$validate = preg_replace('/<>/' , '', $wbddrss);
var_dump($validate);
} ?>
But I would like to replace all chars that do not meet what is allowed.
I guess the best solution would be to replace everything with a caret to negate. But it seems I cant find the right delimiters.
This is the range of characters I would like to allow:
A-Za-z0-9+&@#/%?=~_|!:,.;\(\)
how is this done in a preg_replace function?