I need to extract a string between a particular string pattern.
e.g.
$string = "blah blah <sgs; the string to be extracted ;sgs> blah blah blah";
- I tried using
eregi ( "<sgs;(.*);sgs>", $string ,$regs) --- match not found
- however when i tried
eregi ( "<sgs;(.*)", $string ,$regs)
This gives me the match and then $regs[1] contains string as
$regs[1] = "<sgs; the string to be extracted ;sgs> blah blah blah";
Now I tried using
eregi ( "(.*);sgs>", $string ,$regs)
This is not giving me any match (when I can actually see the match )
Basically now what i need is the part of string till the ';sgs>' part.
Can someone help me in this ?
Thanks in advance.