preg replace - PHP preg_replace regexp for dash -


i trying replace in string not letter, number, or dash "-".

how modify line include dash?

$link = preg_replace('/[^a-z0-9]/', "", strtolower($_post['link_name'])); 

do insert in there?

$link = preg_replace('/[^a-z0-9-]/', "", strtolower($_post['link_name'])); 

you have escape - since it's special character regexes:

$link = preg_replace('/[^a-z0-9\-]/', '', strtolower($_post['link_name'])); 

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 -