Having a problem preserving words.
input:
$string = 21st street 1st street;
or
$string = 21st st 1st st;
$patterns[0] = '[(?<=[0-9])st|nd|rd|th]';
$patterns[1] = '/ave.*?\b/';
$patterns[2] = '' //confused...
$replacements[0] = "";
$replacements[1] = "ave";
$replacements[2] = "st"
$str = preg_replace($patterns, $replacements, $string);
How can I tell it to preserve the first two letters of street and the abbreviation st if it doesn't have a number right behind it?
The output should end up looking like
21 st 1 st
input:
$string = 21st street 1st street;
or
$string = 21st st 1st st;
$patterns[0] = '[(?<=[0-9])st|nd|rd|th]';
$patterns[1] = '/ave.*?\b/';
$patterns[2] = '' //confused...
$replacements[0] = "";
$replacements[1] = "ave";
$replacements[2] = "st"
$str = preg_replace($patterns, $replacements, $string);
How can I tell it to preserve the first two letters of street and the abbreviation st if it doesn't have a number right behind it?
The output should end up looking like
21 st 1 st