I'm no regex guru but something goes wrong here.

First of you miss the second parameter in preg_match

int preg_match ( string pattern, string subject [, array &matches [, int flags 
[, int offset]]] )

If you need the text from two unique tags it should not be to hard:

$test = "<tag lang='ttt'>THIS IS A TEST</tag>";
preg_match("/<tag lang='ttt'>(.+?)<\/tag>/", $test, $matches);
print_r($matches);

Thijs

On Mon, 11 Dec 2006 02:02:46 -0600, "Anthony Papillion" <[EMAIL PROTECTED]> 
wrote:
> Hello Everyone,
> 
> I am having a bit of problems wrapping my head around regular expressions.
> I
> thought I had a good grip on them but, for some reason, the expression
> I've
> created below simply doesn't work! Basically, I need to retreive all of
> the
> text between two unique and specific tags but I don't need the tag text.
> So
> let's say that the tag is
> 
> <tag lang='ttt'>THIS IS A TEST</tag>
> 
> I would need to retreive THIS IS A TEST only and nothing else.
> 
> Now, a bit more information: I am using cURL to retreive the entire
> contents
> of a webpage into a variable. I am then trying to perform the following
> regular expression on the retreived text:
> 
> $trans_text = preg_match("\/<div id=result_box dir=ltr>(.+?)<\/div>/");
> 
> The problem is that when I echo the value of $trans_text variable, I end
> up
> with the entire HTML of the page.
> 
> Can anyone clue me in to what I am doing wrong?
> 
> Thanks,
> Anthony
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to