Here is some PHP that I want to replace with something else.
Ks. <?kys(1959,"kysymys 1959")?>.
Ks. <?kys(1959)?>.
I have this regular expression, which finds both and works fine:
<\?kys\((\d+)(,"([\s\S]+)")?\)\?>
I tested (and designed) it with Regex101.com: https://regex101.com/r/kcDpN3/1
So there will at least be match $1. But there can also be matches $2 and $3. Is it possible to have preg_replace replace the matches with the following logic: if $3, use $3; else use $1?
preg_replace_callback