Re: [PHP] Still having ereg migranes

2002-11-21 Thread Marek Kilimajer
I think you should really ask at a unix list

Mako Shark wrote:


Heheh. Maybe I wasn't clear, or maybe I'm missing
something.

 

Well, one way without regex would be to explode()
numbers on a comma and use in_array() to see if
you're value exists.
That should look for your number, preceded by either
the beginning of the string or a comma and followed 
by either a comma or the end of the string. 
   


I can't use PHP commands to do this. I can only have
an ereg statement, but that has to be placed in a grep
statement. Maybe I should ask a Unix list, but I
figure with the ereg(i) expertise here, this is my
best bet.

By the time my shell_exec() call returns its results,
it should return only those files with the actual
number. At that point, I can't explode() it and start
searching for the number all over again using
in_array() or any other commands. By the time Unix
returns its results, the only thing I can do is carry
on assuming I have only those tags that contain the
number without having to search through the array.

I appreciate the help, but while these commands would
work in some situations, it won't work in mine. The
whole finding-if-it's-in-the-list thing has to happen
in the ereg that I pass to grep.

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

 



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




[PHP] Still having ereg migranes

2002-11-20 Thread Mako Shark
Sorry to repost this, but I haven't found a solution
and it's still nagging me. Maybe some of you can come
up with something I can't. Here was my original post:

I've made myself an INPUT TYPE=HIDDEN tag that
contains in the value attribute a list of
comma-delimited numbers. I need to find if a certain
number is in these tags (and each file contains one
tag). I need an ereg statement that will let me search
these lines to see if a number exists, obviously in
the beginning or the end or the middle or if it's the
only number in the list. So, say I need #1, I need to
grep each file to find if 1 is in its INPUT
TYPE=HIDDEN list. Here's what I mean (searching for
number 1):

INPUT TYPE = HIDDEN NAME = numbers VALUE =
1,2,3,4,5   //beginning

INPUT TYPE = HIDDEN NAME = numbers VALUE =
0,1,2,3,4,5   //middle

INPUT TYPE = HIDDEN NAME = numbers VALUE =
5,4,3,2,1   //end

INPUT TYPE = HIDDEN NAME = numbers VALUE = 1 
//only

I can't grab all the tags and search for it in PHP
(there would be too many tags to parse through and I'd
rather let the OS handle that). I need to do this at
the operating system level. Does anybody yet have a
solution? I *know* it's possible, but I can't get it
and I've been working on it for days now. This is one
of those really annoying bugs that really grates on a programmer.

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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




Re: [PHP] Still having ereg migranes

2002-11-20 Thread Marek Kilimajer
first way:
if(ereg('([^0-9]|^)'.$your_number.'([^0-9]|$)',$_REQUEST['numbers']) )
second way:
$numbers=explode(',',$_REQUEST['numbers']);
if(in_array($your_number,$numbers))

Mako Shark wrote:


Sorry to repost this, but I haven't found a solution
and it's still nagging me. Maybe some of you can come
up with something I can't. Here was my original post:

I've made myself an INPUT TYPE=HIDDEN tag that
contains in the value attribute a list of
comma-delimited numbers. I need to find if a certain
number is in these tags (and each file contains one
tag). I need an ereg statement that will let me search
these lines to see if a number exists, obviously in
the beginning or the end or the middle or if it's the
only number in the list. So, say I need #1, I need to
grep each file to find if 1 is in its INPUT
TYPE=HIDDEN list. Here's what I mean (searching for
number 1):

INPUT TYPE = HIDDEN NAME = numbers VALUE =
1,2,3,4,5   //beginning

INPUT TYPE = HIDDEN NAME = numbers VALUE =
0,1,2,3,4,5   //middle

INPUT TYPE = HIDDEN NAME = numbers VALUE =
5,4,3,2,1   //end

INPUT TYPE = HIDDEN NAME = numbers VALUE = 1 
//only

I can't grab all the tags and search for it in PHP
(there would be too many tags to parse through and I'd
rather let the OS handle that). I need to do this at
the operating system level. Does anybody yet have a
solution? I *know* it's possible, but I can't get it
and I've been working on it for days now. This is one
of those really annoying bugs that really grates on a programmer.

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

 



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




RE: [PHP] Still having ereg migranes

2002-11-20 Thread John W. Holmes
 Sorry to repost this, but I haven't found a solution
 and it's still nagging me. Maybe some of you can come
 up with something I can't. Here was my original post:
 
 I've made myself an INPUT TYPE=HIDDEN tag that
 contains in the value attribute a list of
 comma-delimited numbers. I need to find if a certain
 number is in these tags (and each file contains one
 tag). I need an ereg statement that will let me search
 these lines to see if a number exists, obviously in
 the beginning or the end or the middle or if it's the
 only number in the list. So, say I need #1, I need to
 grep each file to find if 1 is in its INPUT
 TYPE=HIDDEN list. Here's what I mean (searching for
 number 1):
 
 INPUT TYPE = HIDDEN NAME = numbers VALUE =
 1,2,3,4,5   //beginning
 
 INPUT TYPE = HIDDEN NAME = numbers VALUE =
 0,1,2,3,4,5   //middle
 
 INPUT TYPE = HIDDEN NAME = numbers VALUE =
 5,4,3,2,1   //end
 
 INPUT TYPE = HIDDEN NAME = numbers VALUE = 1
 //only
 
 I can't grab all the tags and search for it in PHP
 (there would be too many tags to parse through and I'd
 rather let the OS handle that). I need to do this at
 the operating system level. Does anybody yet have a
 solution? I *know* it's possible, but I can't get it
 and I've been working on it for days now. This is one
 of those really annoying bugs that really grates on a programmer.

Well, one way without regex would be to explode() numbers on a comma and
use in_array() to see if you're value exists.

$ar = explode(',',$_GET['numbers']);
if(in_array($search_number,$ar))
{ //number is present; }
else
{ //number is not present; }

With regex, maybe something like this?

if(preg_match('/^|,'.$search_number.',|$/',$_GET['numbers']))
{ //number is present; }
else
{ //number is not present; }

That should look for your number, preceded by either the beginning of
the string or a comma and followed by either a comma or the end of the
string. 

Let me know if that works. 

---John Holmes...



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




RE: [PHP] Still having ereg migranes

2002-11-20 Thread Mako Shark
first way:
if(ereg('([^0-9]|^)'.$your_number.'([^0-9]|$)',$_REQUEST['numbers'])
) second way:
$numbers=explode(',',$_REQUEST['numbers']);
if(in_array($your_number,$numbers))

Not sure I get this but, again, I can't use $_REQUEST
or explode or in_array at this point. The entire
process needs to happen in the shell_exec() command,
because I'd much rather have that handle the whole
shebang than PHP.

__
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

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