Need help with RegEx
| From: | Anthony Papillion | Date: | Mon, 11 Dec 2006 08:02:46 +0000 |
| Subject: | Need help with RegEx | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-245701@lists.php.net to get a copy of this message | ||
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