Re: [PHP] help with regex in preg_match();

2002-07-01 Thread Erik Price


On Monday, July 1, 2002, at 01:37  PM, <[EMAIL PROTECTED]> wrote:

> I got this line that is relly giving me a pain..:
>
> if (preg_match("@siteUserList.cgi\?group=site177(&?)@",
> $QUERY_STRING))
>
> As you can see it just matches the query string when it looks like
> this: siteUserList.cgi?group=site177& (with or without a "&")
>
> The thing is I need it to match also if after the "&" there is a number
> (that will have more than 1 digit)
>
> Ive tried many diffrent thing with \d+ but I can get it to work.. can
> somebody give me some light? Thanks.

preg_match('/siteUserList.cgi\?group=site177&?(\d\d+)?/', $QUERY_STRING)

that will match the following criteria:
 if there is a "&" sign
 OR a "number with more than 1 digit"
 OR both an "&" sign AND a "number with more than 1 digit"

If you only want it to match if there is BOTH an "&" sign AND a "number 
with more than 1 digit", it should be like this:

preg_match('/siteUserList.cgi\?group=site177(&\d\d+)?/', $QUERY_STRING)







Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] help with regex in preg_match();

2002-07-01 Thread Mirza Muharemagic

Hi,

 something like this:

 $QUERY_STRING = "siteUserList.cgi?group=site177&2345";
 if 
(preg_match("#siteUserList.cgi\?group=site177(&?[\d]*)#",$QUERY_STRING,$array11))
 {
  echo "found: $array11[0]$array11[1]";
 }

 Mirza [EMAIL PROTECTED]


01.07.2002 19:37

> Hi people,

> I got this line that is relly giving me a pain..:

> if (preg_match("@siteUserList.cgi\?group=site177(&?)@", 
> $QUERY_STRING))  

> As you can see it just matches the query string when it looks like 
> this: siteUserList.cgi?group=site177& (with or without a "&")

> The thing is I need it to match also if after the "&" there is a number 
> (that will have more than 1 digit)

> Ive tried many diffrent thing with \d+ but I can get it to work.. can 
> somebody give me some light? Thanks.



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




[PHP] help with regex in preg_match();

2002-07-01 Thread php

Hi people,

I got this line that is relly giving me a pain..:

if (preg_match("@siteUserList.cgi\?group=site177(&?)@", 
$QUERY_STRING))  

As you can see it just matches the query string when it looks like 
this: siteUserList.cgi?group=site177& (with or without a "&")

The thing is I need it to match also if after the "&" there is a number 
(that will have more than 1 digit)

Ive tried many diffrent thing with \d+ but I can get it to work.. can 
somebody give me some light? Thanks.

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