Php preg_match regex

phppreg-matchregex

Still having RegEx issues.. Need to match the following characters

a-zA-z9-0 , . ' " ( ) _ – : (SPACE)

Not all the values will have all these but could have them. I have everything withing but the parentheses, Single and Double Quoytes

/^[\w. ,\/:_-]+$/ 

UPDATE:

I got it working with this: "/^[\w. ,:()'\"-]+$/"

$val_1 = "Abh acb 123 . - _ 's ";
$val_2 = "Asc";
$val_3 = "234";
$val_4 = "nj%"; // Fail
$val_5 = "Help (me)";
$val_6 = "What's wrong?"; // Fail
$val_7 = "She's here";
$val_8 = "No: 123.00, 432.00";
$val_9 = 'Need to " Double" ';

$var_array = array($val_1, $val_2, $val_3, $val_4, $val_5, $val_6, $val_7, $val_8, $val_9);

foreach ($var_array as $k=>$d) {
    if ((preg_match("/^[\w. ,:()'\"-]+$/", $d))) {
        echo "Yeah it matches!!!<span style='color:green'>".$d."</span><br />";
    } else {
        echo "Try again, thie FAILED<span style='color:red'>".$d."</span><br />";
    }
}

Thanks for all for helping out

Best Solution

$pat = "/^[\w. ,\\/:_()'\"-]/";