strreplace php regex code example
Example 1: preg_replace
<?php
$string = 'April 15, 2003';
$pattern = '/(\w+) (\d+), (\d+)/i';
$replacement = '${1}1,$3';
echo preg_replace($pattern, $replacement, $string);
Example 2: replace all numbers in string php
$words = preg_replace('/[0-9]+/', '', $words);