I would like to take a string and delete any characters except 0-9 and - (dash).
Example:
if I have a line that looks like this:
10-abc20-30
How can I return this line
10-20-30
(separate all characters except numbers and dashes)
Is there any regular expression to use in preg_match or str_replace?
string php regex
Devnull
source share