I'm falling deeper into the regex's dark side. I need to parse this:
{{word(a|b|c)|word$1}}
{{word(s?)|word$1}}
{{w(a|b|c)ord(s?)|w$1ord$2}}
As you may have noticed, it is a search & replace scheme, containing regular expressions. The wikimedia engine does it very well, but I couldn't find how it does: right here.
I just need to get the first part, and the second part into two seperated variables. For instance:
preg_match(REGEX, "{{word(a|b|c)|word$1}}", $result) // Applying REGEX on this
echo $result[1] // word(a|b|c)
echo $result[2] // word$1
How would you do ? It's like regex in regex, I'm completely lost...