İşte benim kod
$string = preg_replace("/rad\:([0-9]+)px\;\s+\/\*\sALT\[(.+)\*\/|rad\:([0-9]+)px\;/",("$2"?"$2":"$1"),$string);
Basically, in the regex I've got a pipe |, and I'm searching for two patterns. If there is a match to the first pattern (to the left of the pipe), then I want the it to be replaced with the second capturing group ($2), but if it's a match with the second pattern (to the right of the pipe), then I want it to be replaced with the first capturing group ($1);
The code I've tried doesn't work. Is this possible at all?
Herhangi bir yardım için teşekkür ederiz.