[PHP] Writing xxx OR yyy with a regular expressions`?

2001-12-12 Thread Lauri Vain

Hello there,

I need to write all of the href= contents into an array. Presently I use the
following code, which works like charm:
.CODEpreg_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.
.CODEpreg_match('!(HREF|SRC)=[\\' ]{0,}([^\\']*)[\\']!i', $Content,
$reg_array)./CODE

In other words I replace .CODEHREF./CODE with .CODE(HREF|SRC)./CODE.

Any ideas how to make the script support both?

Yours,
Lauri
--
Tharapita Creations
[dynamic web applications]
[EMAIL PROTECTED]
Mobile: +372 53 401 312


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Writing xxx OR yyy with a regular expressions`?

2001-12-12 Thread Andrey Hristov

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:
 .CODEpreg_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.
 .CODEpreg_match('!(HREF|SRC)=[\\' ]{0,}([^\\']*)[\\']!i', $Content,
 $reg_array)./CODE

 In other words I replace .CODEHREF./CODE with
 .CODE(HREF|SRC)./CODE.

 Any ideas how to make the script support both?

 Yours,
 Lauri


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]