Regex and regex only....
Just use the below regex to match the text which you don't want and
then replace it with an empty string.
(?<=[[)(?:(?!]]||).)*||[[|]]
DEMO
Code:
<?php
$str = "loads of text [[gibberish text|Text i Want]] more text
[[gibberish text|Text i Want]] more text [[if no separator then just
remove tags]]";
echo preg_replace("/(?<=[[)(?:(?!]]||).)*||[[|]]/m", "", $st

It looks like its erroring. If you take the code below and leave out
the var declaration. The it will give the "start" alert. But the
if's will fail to show an alert. I think because the var is
technically null at that point.
Or you have hidden characters in the returned string. Might want to
check the character lenth of the returned string to see if it is
indeed the value you "see".
You ma

Ah, seems the problem was with mouseover/mouseout. Changing
$(".sectionstyle").mouseover(...) to
$(".sectionstyle").mouseenter(...), and similarly swapping mouseout()
for mouseleave(), solves the issue.
Thanks to Reddit's /u/rbobby in /r/webdev for that one, they got to it
before SO. :)

There are a number of ways to recreate strstr. The following is a
quick implementation using the inch-worm method, where you simply use
pointers to search for the beginning of the substring in string, then
if found, compare every character in substring with the corresponding
character in string. If all characters match, the substring is found,
return a pointer to the beginning of substring in stri