note 104965 deleted from function.preg-replace by crell
| From: | crell@php.net | Date: | Fri, 01 Jul 2022 19:36:48 +0000 |
| Subject: | note 104965 deleted from function.preg-replace by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218839@lists.php.net to get a copy of this message | ||
Note Submitter: sreekanth at outsource-online dot net
----
if your intention to code and decode mod_rewrite urls and handle it with php and mysql ,this should
work
to convert to url
$url = preg_replace('/[^A-Za-z0-9_-]+/', '-', $string);
And to check in mysql with the url value,use the same expression discounting '-'.
first replace the url value with php using preg_replace and use with mysql REGEXP
$sql = "select * from table where fieldname_to_check REGEXP
'".preg_replace("/-+/",'[^A-Za-z0-9_]+',$url)."'"