Answer the question
In order to leave comments, you need to log in
How to prevent character input except for some using preg_replace?
There is a lot of material on the Internet about this, but I would like to know specific things for myself. How to prohibit all characters in the $title variable , except for ,.- , and insert - instead of prohibited ones - and so that - does not repeat more than once.
Input data: Cyrillic and Latin.
$title = preg_replace("/[^A-Za-z0-9]/"," ",$title);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question