im using preg_replace to filter coming from a form.
i'd like to allow double quotes and single quotes could somebody help me out.
-This is what i have currently!
$t1 = preg_replace("/[^a-z0-9\/!?:,.;$><_ ]/", '', $title);
Allowing quotes in preg_replace, please help
Moderator: General Moderators
-
robertbarzyk
- Forum Newbie
- Posts: 19
- Joined: Tue Oct 06, 2009 4:12 pm
Re: Allowing quotes in preg_replace, please help
escape them.
like so
\" \'
like so
\" \'
-
robertbarzyk
- Forum Newbie
- Posts: 19
- Joined: Tue Oct 06, 2009 4:12 pm
Re: Allowing quotes in preg_replace, please help
Thanks, i know im doing something else wrong... probably real simple
this is my code now
$t1 = preg_replace("/[^a-z0-9\/!?\" \' :,.;$><_ ]/", '', $title);
mysql_query("INSERT INTO pages SET
title='$t1',
num='$num'");
it will allow double quotes but not single quotes... what am i doing wrong?
this is my code now
$t1 = preg_replace("/[^a-z0-9\/!?\" \' :,.;$><_ ]/", '', $title);
mysql_query("INSERT INTO pages SET
title='$t1',
num='$num'");
it will allow double quotes but not single quotes... what am i doing wrong?