Re: Writing "xxx" OR "yyy" with a regular expressions`?
| From: | Andrey Hristov | Date: | Thu, 13 Dec 2001 02:20:40 +0000 |
| Subject: | Re: Writing "xxx" OR "yyy" with a regular expressions`? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-77472@lists.php.net to get a copy of this message | ||
Try this :
preg_match('!(HREF|SRC)=([\"\']?)(.*?)\2!i',$Content,$reg_array);
HTH
Regards,
--
Andrey Hristov
Web Developer
Icygen Corporation
BUILDING SOLUTIONS
http://www.icygen.com
On Wednesday 12 December 2001 02:06 pm, you wrote:
> Hello there,
>
> I need to write all of the href="" contents into an array. Presently I use
> the following code, which works like charm:
> <.CODE>preg_match('!HREF=[\"\'
]{0,}([^\"\'>]*)[\"\'>]!i', $Content,
> $reg_array)<./CODE>
>
> That, however, doesn't support Frames so I would need to make the script
> match "HREF" or "SRC". I tried the following code, but it doesn't want
to
> support frames and ceases to support usual HREF's as well.
> <.CODE>preg_match('!(HREF|SRC)=[\"\'
]{0,}([^\"\'>]*)[\"\'>]!i', $Content,
> $reg_array)<./CODE>
>
> In other words I replace <.CODE>HREF<./CODE> with
> <.CODE>(HREF|SRC)<./CODE>.
>
> Any ideas how to make the script support both?
>
> Yours,
> Lauri