Re: [PHP] quick ereg() question

2002-08-17 Thread Jason Wong

On Sunday 18 August 2002 05:53, eriol wrote:

> It works fine on .php files but I was hoping I could include .inc files as
> well when someone wanted to view the source of them.. To include .inc files
> as viewable php source code, I'd rewrite it similar to below I assume, but
> I'm not understanding the syntax I'm missing..
>
>
> if (ereg("(\.inc | .php)$",$o0o) && !ereg("\/\.\.", $o0o)){
>   ...
> }
>
>
> I know I have to use a pipe to seperate allowable file types, but that's
> the extent of what I know.. Any help would be appreciated.. TIA..

A period (.) has a special meaning in that it matches any character. To match 
a literal period you have to escape it with a backslash:

  if (ereg("(\.inc | \.php)$",$o0o) && !ereg("\/\.\.", $o0o)) {

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
vacation, n.:
A two-week binge of rest and relaxation so intense that
it takes another 50 weeks of your restrained workaday
life-style to recuperate.
*/


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




Re: [PHP] quick ereg() question

2002-08-17 Thread eriol

Thank you Bas.. I appreciate the reply.. It works great..

Take care.. peace..
eriol



"Bas Jobsen" <[EMAIL PROTECTED]> disgorged:

: if (ereg("((\.)(php|inc))$",$o0o) && !ereg("\/\.\.", $o0o)){



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




Re: [PHP] quick ereg() question

2002-08-17 Thread Bas Jobsen

if (ereg("((\.)(php|inc))$",$o0o) && !ereg("\/\.\.", $o0o)){

Op zaterdag 17 augustus 2002 23:53, schreef eriol:
> I checked the manual and it's comments as well as google, but didn't find
> the simple answer i'm wanting..
>
> I have the following line in a "show php source code" page:
>
>
> if (ereg("(\.php)$",$o0o) && !ereg("\/\.\.", $o0o)){
>   ...
> }
>
>
> It works fine on .php files but I was hoping I could include .inc files as
> well when someone wanted to view the source of them.. To include .inc files
> as viewable php source code, I'd rewrite it similar to below I assume, but
> I'm not understanding the syntax I'm missing..
>
>
> if (ereg("(\.inc | .php)$",$o0o) && !ereg("\/\.\.", $o0o)){
>   ...
> }
>
>
> I know I have to use a pipe to seperate allowable file types, but that's
> the extent of what I know.. Any help would be appreciated.. TIA..
>
> Take care.. peace..
> eriol

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




[PHP] quick ereg() question

2002-08-17 Thread eriol

I checked the manual and it's comments as well as google, but didn't find the
simple answer i'm wanting..

I have the following line in a "show php source code" page:


if (ereg("(\.php)$",$o0o) && !ereg("\/\.\.", $o0o)){
  ...
}


It works fine on .php files but I was hoping I could include .inc files as well
when someone wanted to view the source of them.. To include .inc files as
viewable php source code, I'd rewrite it similar to below I assume, but I'm not
understanding the syntax I'm missing..


if (ereg("(\.inc | .php)$",$o0o) && !ereg("\/\.\.", $o0o)){
  ...
}


I know I have to use a pipe to seperate allowable file types, but that's the
extent of what I know.. Any help would be appreciated.. TIA..

Take care.. peace..
eriol




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