hhawkins Posted November 5, 2007 Share Posted November 5, 2007 I have this - $var = preg_replace("/[^A-Za-z0-9_, -]/", "", $var); But I want to add special characters to be allowed, is it as simple as /W? Or do I need to just add them individually? $var = preg_replace("/[^A-Za-z0-9_$!#, -]/", "", $var); This is feeding into a sql database should I not allow the use of / or \. Thanks! Link to comment https://forums.phpfreaks.com/topic/76091-preg_replace-password/ Share on other sites More sharing options...
effigy Posted November 5, 2007 Share Posted November 5, 2007 What is not allowed--just slashes? Link to comment https://forums.phpfreaks.com/topic/76091-preg_replace-password/#findComment-385175 Share on other sites More sharing options...
hhawkins Posted November 5, 2007 Author Share Posted November 5, 2007 Well what it is feeding into says everything is allowed - ! " # $ % & ( ) + , - / ; < = > ? [ \ ] ^ _ ` { | } * ' I want to attempt to allow that with out creating another issue. Link to comment https://forums.phpfreaks.com/topic/76091-preg_replace-password/#findComment-385231 Share on other sites More sharing options...
effigy Posted November 5, 2007 Share Posted November 5, 2007 \W is the complement of [a-zA-Z0-9_], so it would function as if you used . with the /s modifier, effectively matching anything. You'll need to add these individually. Link to comment https://forums.phpfreaks.com/topic/76091-preg_replace-password/#findComment-385247 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.