I have the following possible strings:
NL DE
NL,DE
nl DE
nl de
NL/DE
NL,mismatch,DE
I’m looking for the preg_match that produces the following output given the inputs above.
array(
[0]=>"NL",
[1]=>"DE"
);
I’ve tried the following code:
preg_match_all('/(\w{2,2})/ui', $info["country"], $m);
but that seems to also cut up the word mismatch, which is undesired.
The regex should only match two letter country codes, everything else should be ignored.
How can I do this using preg_match in PHP?
Hope it helps.