I need to match the following pattern:
return character 5 character string, A-Z, 0-( space
For example:
ABC65
CG876
Each with a return character before and a space after. What regular expression should I use for this? Using PHP
I need to match the following pattern:
return character 5 character string, A-Z, 0-( space
For example:
ABC65
CG876
Each with a return character before and a space after. What regular expression should I use for this? Using PHP
$yourstring = "ABC65 CG876";
echo preg_replace('/([A-Z0-9]{5}) /', '${1}<br />', $yourstring);
It seems I misunderstood (or misinterpreted) your question. So the correct answer in my opinion is:
^[A-Z0-9 ]{5}$