php - How to transform this Regex -


i'm trying figure out does, , how change it.

preg_replace('/[^\w\s]/','',$var); 

i think replaces symbols nothing (deletes them basically). if want allow specific symbols, change here?

for example want replace except:

  • /
  • numbers
  • letters
  • spaces

thanks.

^ means this, replaces word characters (\w) , whitespace (\s).

to replace except characters mention, use this:

preg_replace('/[^\w\s\/]/', '', $var); 

\/ escaped version of /.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -