Is there a simple ReGex for getting the answer in $Find.... I want it to include the {} in the answer..
Actually I need it with and without but I can strip the {} after I use it with the {}
I am building a WP plugin so I need it with the {} so I can tell it to replace the entire thing in the_content
However once I have that variable saved of course I need to break it apart in to its two separate parts... unless REGEX does that easily I can use PHP to do it... so actually I need the following 3 variables pulled out separate..
Variable 1. {tomurl|http://mydomain.com/newpage.php?dat=test}
Variable 2. tomurl
Varialbe 3. http://mydomain.com/newpage.php?dat=test
I know how to do expode and all the junk to separate it unless REGEX can do it in one flail swoop.
<?php
$text = <<<MYDATA
Some stuff.......
{tomurl|http://mydomain.com/newpage.php?dat=test}
More stuff......
MYDATA;
echo "$text<br>";
$s1 = strpos($text, '{');
$s2 = strpos($text, '}');
echo "S1 = $s1<br>";
echo "S2 = $s2<br>";
$find = substr($text, $s1, $s2-$s1+1);
echo "Find = $find<br>";
?>
Final Results:
TEXT = Some stuff....... {tomurl|http://mydomain.com/newpage.php?dat=test} More stuff......
S1 = 18
S2 = 66
Find = {tomurl|http://mydomain.com/newpage.php?dat=test}