I have the following string: $var = "Saudi Arabia U23 x South Korea U23";
I want to split the names that are separated by "x"
, I did the following:
$arr = preg_split('/[v|x]/', $var);
I used% w /% because sometimes the string could come with a "v" separating the names, not the X, the problem is that if you have an "x" or "v" included in the name, x "or the" v "of the split, it will cut too, but I just want to separate the names delimited by "V e X"
or " x "
.
How would I do this in regex?