i.e.
~~~~~ startX _grab this unknown content_ endY ~~~~~~~
Sample Code
<?
$string ="Hello World and Goodbye World"; //Attempting to retrieve-> World and Goodbye
//___________\/ This should tell the RegEx to start looking here, but it isn't working.....
preg_match("/(?<=Hello ).*(?= World)/" , $string , $World_and_Goodbye);
echo "Matched: " . $World_and_Goodbye[0] . "<br>\n";
//__________\/ This kind of works, but you have to include that that char in the output, then strip it...
preg_match("/o .* (?=World)/i" , $string , $World_and_Goodbye);
echo "Matched: " . $World_and_Goodbye[0] . "<br>\n";
?>
The lookbehind seems to nullify any match attempt, while the lookahead is working flawlessly.
RegEX Coach says I'm not insane
Am I mis-interpreting the function of the lookbehind, or is there a better way to extract unknown info between two known strings?
I thank you for your time, and greatly appreciate any response/input you might have.