I have the following string format:
[[TEXT|TEXT]] <-- the "|TEXT" is optional
And so far what works fine is:
/([^\[]+)(?=\]\])/
Which will return:
TEXT
or
TEXT|TEXT
I want to match up to "|TEXT" if it has been included and only ever match the left side of "|" or "]]" depending on which is first.
Any suggestions?