Re: help with preg_match
| From: | Robert Williams | Date: | Mon, 04 Jun 2012 01:37:23 +0000 |
| Subject: | Re: help with preg_match | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-318131@lists.php.net to get a copy of this message | ||
On Jun 3, 2012, at 17:28, "Chris Purves" <chris@northfolk.ca> wrote:
> I know that the text ends 'end', but I don't know what the Something,
> something is. I am using preg_match as follows:
>
> preg_match('/[^>]*end/',$curl_response,$matches);
>
> I want to match 'end' and everything before it that is not '>'.
You need to match something at the beginning. Try this:
preg_match('/>([^>]*end)/', $curl_response, $matches);
Assuming a match, you can then look to $matches[1] for your content.
--
Bob Williams
Notice: This communication, including attachments, may contain information that is confidential. It
constitutes non-public information intended to be conveyed only to the designated recipient(s). If
the reader or recipient of this communication is not the intended recipient, an employee or agent of
the intended recipient who is responsible for delivering it to the intended recipient, or if you
believe that you have received this communication in error, please notify the sender immediately by
return e-mail and promptly delete this e-mail, including attachments without reading or saving them
in any manner. The unauthorized use, dissemination, distribution, or reproduction of this e-mail,
including attachments, is prohibited and may be unlawful. If you have received this email in error,
please notify us immediately by e-mail or telephone and delete the e-mail and the attachments (if
any).