2
I have the following string: $var = "Saudi Arabia U23 x South Korea U23";
I want to divide the names that are separated by "x"
, I did the following:
$arr = preg_split('/[v|x]/', $var);
I used "V e X"
because sometimes the string can come with a "v" separating the names, and not X, the problem is that if you have an "x" or "v" included in the name, other than the "x" or "v" of the separation, it will cut too, but I just want to separate the names delimited by " x "
or " v "
.
How would you do it in regex?
This is logically impossible. Do you have a way to change the tab using characters that do not appear in the name? , for example with -(Hyphen)
– Rodrigo Santiago