I have string in format as below:
ABC 318 XY2388
I tried to use preg replace function in PHP with Regex but having no knowledge of reg ex I am not getting anywhere.
I want above string to end up like ABC 318/XY 2388
So the rule is:
I will appreciate any help on this.
This code changes the string using the corrected rule/example you are giving:
$input = "ABC 318 XY2388";
$output = preg_replace("/([A-Z]*) (\d*) ([A-Z]*)(\d*)/","$1 $2/$3 $4", $input);
echo $output;
Result: ABC 318/XY 2388
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments