Re: [PHP] Regular Expressions Help

2002-06-05 Thread J. Younker

Thanks, Jim!
That's exactly what I needed.
J.

Jim Lucas wrote:

> not sure why you have such a complex reg there, but will this work for you.
>
> preg_replace("/(http:\/\/)?([^\/ ]*)(.*);/", "http://\\2\\3";, $str);
>
> \\1  = http://  ;  if there
> \\2  = domain
> \\3  = request_uri
>
> Jim Lucas
> - Original Message -
> From: "J. Younker" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 05, 2002 8:22 AM
> Subject: [PHP] Regular Expressions Help
>
> > Hi,
> > I'm trying to use eregi_replace to check a user-submitted URL, but I
> > keep getting the following error message:
> > Warning: Invalid range end in /var/www/html/_db_db/db_input.php
> > This what I'm using:
> > $pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.-_?/&=])";
> > $replace = "http://\\2\\3";;
> > $URL = eregi_replace($pattern, $replace, $URL);
> > I've stared at this expression for too long and can't figure out what's
> > wrong.
> > Thanks,
> > J. Younker
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >


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




Re: [PHP] Regular Expressions Help

2002-06-05 Thread Jim lucas

not sure why you have such a complex reg there, but will this work for you.

preg_replace("/(http:\/\/)?([^\/ ]*)(.*);/", "http://\\2\\3";, $str);

\\1  = http://  ;  if there
\\2  = domain
\\3  = request_uri

Jim Lucas
- Original Message - 
From: "J. Younker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 05, 2002 8:22 AM
Subject: [PHP] Regular Expressions Help


> Hi,
> I'm trying to use eregi_replace to check a user-submitted URL, but I
> keep getting the following error message:
> Warning: Invalid range end in /var/www/html/_db_db/db_input.php
> This what I'm using:
> $pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.-_?/&=])";
> $replace = "http://\\2\\3";;
> $URL = eregi_replace($pattern, $replace, $URL);
> I've stared at this expression for too long and can't figure out what's
> wrong.
> Thanks,
> J. Younker
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




[PHP] Regular Expressions Help

2002-06-05 Thread J. Younker

Hi,
I'm trying to use eregi_replace to check a user-submitted URL, but I
keep getting the following error message:
Warning: Invalid range end in /var/www/html/_db_db/db_input.php
This what I'm using:
$pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.-_?/&=])";
$replace = "http://\\2\\3";;
$URL = eregi_replace($pattern, $replace, $URL);
I've stared at this expression for too long and can't figure out what's
wrong.
Thanks,
J. Younker

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




Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz

I wasn't paying that much attention. The /i is a preg thing. It's the same 
as changing from ereg to eregi.

miguel

On Wed, 1 May 2002, John Fishworld wrote:
> aha !
> thats very strange then because mine works at the moment but if I add the /i
> at the end then it doesn't !
> 
> > On Wed, 1 May 2002, John Fishworld wrote:
> > > Thanks after playing about with that I've got the following which does
> seem
> > > to work !
> > >
> > > $imode_code[$i] = eregi_replace("(src=)(\")([a-z0-9_\/-]+\.gif)(\")",
> > > "\\1\\2$path/\\3\\2", $imode_code[$i]);
> > >
> > > Very very very slowly getting the hang of regexs !
> > >
> > > What does your /i do at the end ???
> >
> > Makes it case-insensitive, so "gif" and "GIF" are treated identically.
> >
> > miguel
> >
> >
> 
> 
> 


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




Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld

aha !
thats very strange then because mine works at the moment but if I add the /i
at the end then it doesn't !

> On Wed, 1 May 2002, John Fishworld wrote:
> > Thanks after playing about with that I've got the following which does
seem
> > to work !
> >
> > $imode_code[$i] = eregi_replace("(src=)(\")([a-z0-9_\/-]+\.gif)(\")",
> > "\\1\\2$path/\\3\\2", $imode_code[$i]);
> >
> > Very very very slowly getting the hang of regexs !
> >
> > What does your /i do at the end ???
>
> Makes it case-insensitive, so "gif" and "GIF" are treated identically.
>
> miguel
>
>



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




Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz

On Wed, 1 May 2002, John Fishworld wrote:
> Thanks after playing about with that I've got the following which does seem
> to work !
> 
> $imode_code[$i] = eregi_replace("(src=)(\")([a-z0-9_\/-]+\.gif)(\")",
> "\\1\\2$path/\\3\\2", $imode_code[$i]);
> 
> Very very very slowly getting the hang of regexs !
> 
> What does your /i do at the end ???

Makes it case-insensitive, so "gif" and "GIF" are treated identically.

miguel


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




Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld

Thanks after playing about with that I've got the following which does seem
to work !

$imode_code[$i] = eregi_replace("(src=)(\")([a-z0-9_\/-]+\.gif)(\")",
"\\1\\2$path/\\3\\2", $imode_code[$i]);

Very very very slowly getting the hang of regexs !

What does your /i do at the end ???

Thanks

> Try this:
>
>   preg_match_all("/src=(\'[a-z0-9_\/-]+\.gif\')/i", $input, $MATCH);
>   print_r($MATCH);
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Money is its own reward.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong

On Tuesday 30 April 2002 21:09, John Fishworld wrote:
> Duh ! lol sorry !

>   href="imode.fpl?op=imodecard&prefix=IMODE&nummer=1&suffx=&uid=55%2eFAGAE&pa


> > > > Unfortunately, no. Could you post say 20 lines of this file you're
> > > > talking about.
> >
> > I mean the file that you're readingparsing, not your program.

Try this:

  preg_match_all("/src=(\'[a-z0-9_\/-]+\.gif\')/i", $input, $MATCH);
  print_r($MATCH);

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

/*
Money is its own reward.
*/

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




Re: [PHP] regular expressions help please

2002-04-30 Thread Miguel Cruz

On Tue, 30 Apr 2002, Ed Lazor wrote:
> Pull everything except a specific word from a sentence.  For example, 
> pulling everything except the word run from "the water run was steep".

   $str = 'the water run was steep';
   print preg_replace('/(\s*water)/', '', $str);

> Pull all words from a string starting with a specific letter or 
> pattern.  For example, pulling all of the words starting with the letter r 
> from "run beep burp ran rin ron runt zoot zip pow"

   $str = 'run beep burp ran rin ron runt zoot zip pow';
   if (preg_match_all('/(\br\w+\b)/', $str, $matches))  
  print join(' ', $matches[1]);

> Pulling all words from a string excluding ones starting with a specific
> letter or pattern.  For example, pulling all of the words except ones
> starting with the letter r from "run beep burp ran rin ron runt zoot zip
> pow"

   $str = 'run beep burp ran rin ron runt zoot zip pow';
   if (preg_match_all('/([\b\W][^r]\w+\b)/', $str, $matches))
  print join(' ', $matches[1]);

> Pulling a word between two other words without having to know what the
> word is.  For example, pulling whatever word displays between "the" and
> "sky".  If the string was "the blue sky", the result would be the word
> blue.  If the string were "the green sky", the result would be the word
> green.

   $str = 'the green sky';  
   if (preg_match('/the\s+(\S+?)\s+sky/', $str, $matches))
  print $matches[1];   

> I apologize in advance if these are really simple.  It's just that I'm
> new to regular expressions and reading all of the web page tutorials,
> manual pages, and mailing list archive messages has left me thinking I'm
> complicating something somewhere, because it really shouldn't be this
> hard.

Well, it's not trivial. Regular expressions is a whole complete language,
entirely separate from PHP, with a lot to learn. Practice enough, though,
and you'll start to see how you can do amazing things with it.

Also, I'd recommend using the Perl-style regex (preg_ rather than ereg_
functions) and reading 'man perlre' if it's installed on your system
(someone can probably suggest a web location for that text).

miguel


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




Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld

Duh ! lol sorry !

Example 1



 
 
 Locations
 
 
  
  Welcome to

 Your Preference:
 驪 Schwul
 Lesbisch

  
 


Example 2

i-mode




  Auswahl
  Mehr Karten
  Karten suchen
  Impressum


 Edgars Auswahl

 verschicken
 verschicken
 verschicken
 verschicken




  http://www.baesurl.com/imenu/";>i-menu





> On Tuesday 30 April 2002 19:43, John Fishworld wrote:
>
> > $imode_code = file("$url_file");
> > $file_name = basename($url_file);
> > $path = dirname($url_file);
> > $stripped_path = eregi_replace("^(.{2,6}://)?[^/]*/", "", $path);
>
> > > On Tuesday 30 April 2002 19:17, John Fishworld wrote:
> > > > Okay right I'm experimenting with an i-mode parser !
> > > > I copy the file (url entered) to a local location !
> > > > Then read through the whole file line at a time and change/replace
the
> > > > things that need replaceing !
> > > > On of the things that I need to replace is the links to the pictures
so
> > > > that they still show even !
> > > > I've already got from the original file the original location
> > > > http://www.whatever.com
> > > > and now want to insert that in front of the gif files
> > > > ie
> > > > $imode_code[$i] = eregi_replace("( > > > "\\1$next_path\\2",$imode_code[$i]);
> > > >
> > > > There are just gif files in this !
> > > >
> > > > Does that make more sense ?
> > >
> > > Unfortunately, no. Could you post say 20 lines of this file you're
> > > talking about.
>
> I mean the file that you're readingparsing, not your program.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> The absent ones are always at fault.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong

On Tuesday 30 April 2002 19:43, John Fishworld wrote:

> $imode_code = file("$url_file");
> $file_name = basename($url_file);
> $path = dirname($url_file);
> $stripped_path = eregi_replace("^(.{2,6}://)?[^/]*/", "", $path);

> > On Tuesday 30 April 2002 19:17, John Fishworld wrote:
> > > Okay right I'm experimenting with an i-mode parser !
> > > I copy the file (url entered) to a local location !
> > > Then read through the whole file line at a time and change/replace the
> > > things that need replaceing !
> > > On of the things that I need to replace is the links to the pictures so
> > > that they still show even !
> > > I've already got from the original file the original location
> > > http://www.whatever.com
> > > and now want to insert that in front of the gif files
> > > ie
> > > $imode_code[$i] = eregi_replace("( > > "\\1$next_path\\2",$imode_code[$i]);
> > >
> > > There are just gif files in this !
> > >
> > > Does that make more sense ?
> >
> > Unfortunately, no. Could you post say 20 lines of this file you're
> > talking about.

I mean the file that you're readingparsing, not your program.

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

/*
The absent ones are always at fault.
*/

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




Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld

$imode_code = file("$url_file");
$file_name = basename($url_file);
$path = dirname($url_file);
$stripped_path = eregi_replace("^(.{2,6}://)?[^/]*/", "", $path);

$next_path = eregi_replace($stripped_path, "", $path);
$next_path_1 = eregi_replace("/$" , "", $next_path);

// create and open a file to write to
$new_file = "files/".$file_name;
$fh = fopen($new_file , "w");

$lines = count($imode_code);
// echo "Lines = $lines";

for ($i; $i<$lines; $i++) {

// add server path to gifs with front slashes /hello/john.gif
// $imode_code[$i] = eregi_replace("([^\"]+[/+]+[a-z_/-]+[gif]+[/$])",
"$next_path_1\\0",$imode_code[$i]);

// add server path to gifs withour front slashes john.gif
// $imode_code[$i] = eregi_replace("\.gif" ,
"$next_path/\\0",$imode_code[$i]);

// changes links so also for server paths for html + chtml + php

// $imode_code[$i] = eregi_replace("([a-z_]+[.]+[chtml])",
"$next_path_1\\0",$imode_code[$i]);
// $imode_code[$i] = eregi_replace("([^\"]+[a-z_]+[\.html]+[\"$])",
"$next_path_1\\0",$imode_code[$i]);
// $imode_code[$i] = eregi_replace("([^\"]+[a-z_]+[\.php]+[\"$])",
"$next_path_1\\0",$imode_code[$i]);

// replace imode pictos with a real gif
$imode_code[$i] = ereg_replace("&#([0-9]{5});" , "" , $imode_code[$i] );

// write the whole lot to file
fputs ($fh, $imode_code[$i]);
}
// close file
fclose($fh);
// display file
echo "
   ";

?>




> On Tuesday 30 April 2002 19:17, John Fishworld wrote:
> > Okay right I'm experimenting with an i-mode parser !
> > I copy the file (url entered) to a local location !
> > Then read through the whole file line at a time and change/replace the
> > things that need replaceing !
> > On of the things that I need to replace is the links to the pictures so
> > that they still show even !
> > I've already got from the original file the original location
> > http://www.whatever.com
> > and now want to insert that in front of the gif files
> > ie
> > $imode_code[$i] = eregi_replace("( > "\\1$next_path\\2",$imode_code[$i]);
> >
> > There are just gif files in this !
> >
> > Does that make more sense ?
>
> Unfortunately, no. Could you post say 20 lines of this file you're talking
> about.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> You are in a maze of little twisting passages, all different.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong

On Tuesday 30 April 2002 19:17, John Fishworld wrote:
> Okay right I'm experimenting with an i-mode parser !
> I copy the file (url entered) to a local location !
> Then read through the whole file line at a time and change/replace the
> things that need replaceing !
> On of the things that I need to replace is the links to the pictures so
> that they still show even !
> I've already got from the original file the original location
> http://www.whatever.com
> and now want to insert that in front of the gif files
> ie
> $imode_code[$i] = eregi_replace("( "\\1$next_path\\2",$imode_code[$i]);
>
> There are just gif files in this !
>
> Does that make more sense ?

Unfortunately, no. Could you post say 20 lines of this file you're talking 
about.

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

/*
You are in a maze of little twisting passages, all different.
*/

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




Re: [PHP] regular expressions help please

2002-04-30 Thread John Fishworld

Okay right I'm experimenting with an i-mode parser !
I copy the file (url entered) to a local location !
Then read through the whole file line at a time and change/replace the
things that need replaceing !
On of the things that I need to replace is the links to the pictures so that
they still show even !
I've already got from the original file the original location
http://www.whatever.com
and now want to insert that in front of the gif files
ie
$imode_code[$i] = eregi_replace("( On Tuesday 30 April 2002 16:31, John Fishworld wrote:
> > I'm trying to find files in my array
> > for example
> > ="lg_imode.gif"
> > and
> > ="/db/imodeklein/edgar-IMODE-1-.gif"
>
> Perhaps you should clarify your problem. First of all does your array
contain
> just gif files (ie *.gif) or does it contain all sorts of files? (ie
> readme.txt, important.doc, funny.gif etc)
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> In a consumer society there are inevitably two kinds of slaves:
> the prisoners of addiction and the prisoners of envy.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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




Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong

On Tuesday 30 April 2002 16:31, John Fishworld wrote:
> I'm trying to find files in my array
> for example
> ="lg_imode.gif"
> and
> ="/db/imodeklein/edgar-IMODE-1-.gif"

Perhaps you should clarify your problem. First of all does your array contain 
just gif files (ie *.gif) or does it contain all sorts of files? (ie 
readme.txt, important.doc, funny.gif etc)

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

/*
In a consumer society there are inevitably two kinds of slaves:
the prisoners of addiction and the prisoners of envy.
*/

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




RE: [PHP] regular expressions help please

2002-04-30 Thread Ford, Mike [LSS]

> -Original Message-
> From: John Fishworld [mailto:[EMAIL PROTECTED]]
> Sent: 30 April 2002 09:32
> 
> I'm trying to find files in my array
> for example
> ="lg_imode.gif"
> and
> ="/db/imodeklein/edgar-IMODE-1-.gif"
> 
> I want to differentiate between the files with slash at the 
> front and ones
> without so that
> I can add a server path !

If all you want is to differentiate the ones where the first letter is a "/", why 
don't you just check exactly that?

foreach ($array as $key=>$fname):
if ($fname{0} =='/'):
// begins with slash -- add server path
endif;
endforeach;

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




[PHP] regular expressions help please

2002-04-30 Thread John Fishworld

I'm trying to find files in my array
for example
="lg_imode.gif"
and
="/db/imodeklein/edgar-IMODE-1-.gif"

I want to differentiate between the files with slash at the front and ones
without so that
I can add a server path !
but as usual I' m having problems with the correct regex

At the moment I've got this to find files with forward slash
eregi_replace("([^\"]+[/+]+[a-z_/-]+[gif]+[/$])" ,
and it seems to work.(although I think it's wrong)

And I'm trying this to find the files without the slash at the front
eregi_replace("([^\"]+(a-z_)+[gif]$)" ,

which is definately not working.

help !




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




Re: [PHP] regular expressions help please

2002-04-30 Thread Jason Wong

On Tuesday 30 April 2002 15:51, Ed Lazor wrote:
> I've been banging my head against regular expressions all night... help
> would be greatly appreciated.  Could you give me examples on how to do the
> following?

Is this for a programming assignment/exercise? Do you /have/ to use regex? 
Other methods may be easier. I'll do the two simple ones:

> Pull everything except a specific word from a sentence.  For example,
> pulling everything except the word run from "the water run was steep".

a) Use str_replace(), search for 'run ' (or ' run') and replace with ''.
b) explode() the string, put 'run' (and any other words you don't want) into 
an array, then use array_diff()

> Pull all words from a string starting with a specific letter or
> pattern.  For example, pulling all of the words starting with the letter r
> from "run beep burp ran rin ron runt zoot zip pow"

a) explode() the string, loop through array check 1st char of each element.

> I apologize in advance if these are really simple.  It's just that I'm new
> to regular expressions and reading all of the web page tutorials, manual
> pages, and mailing list archive messages has left me thinking I'm
> complicating something somewhere, because it really shouldn't be this hard.

As you can see, a bit of lateral thinking can get you the same results 
without the headbanging. Using regex can be expensive in terms of CPU cycles 
and very often simpler methods will suffice. By all means learn regexes as 
they are damn useful. But start simple then build upon it.

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

/*
A full belly makes a dull brain.
-- Ben Franklin

[and the local candy machine man.  Ed]
*/

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




[PHP] regular expressions help please

2002-04-30 Thread Ed Lazor

I've been banging my head against regular expressions all night... help 
would be greatly appreciated.  Could you give me examples on how to do the 
following?

Pull everything except a specific word from a sentence.  For example, 
pulling everything except the word run from "the water run was steep".

Pull all words from a string starting with a specific letter or 
pattern.  For example, pulling all of the words starting with the letter r 
from "run beep burp ran rin ron runt zoot zip pow"

Pulling all words from a string excluding ones starting with a specific 
letter or pattern.  For example, pulling all of the words except ones 
starting with the letter r from "run beep burp ran rin ron runt zoot zip pow"

Pulling a word between two other words without having to know what the word 
is.  For example, pulling whatever word displays between "the" and 
"sky".  If the string was "the blue sky", the result would be the word 
blue.  If the string were "the green sky", the result would be the word green.

I apologize in advance if these are really simple.  It's just that I'm new 
to regular expressions and reading all of the web page tutorials, manual 
pages, and mailing list archive messages has left me thinking I'm 
complicating something somewhere, because it really shouldn't be this hard.

Thanks in advance for any help you can offer.

-Ed


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




RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy

The problem is that exec() is looking for an immediate output and since I am
calling a command line program it doesn't return fast enough for it (I
think).  The popen or fopen looks like it would work, but I don't understand
how to execute the command.  Ie.



 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 4:30 PM
To: 'Darren Gamble'; 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

exec() can capture ALL output from a command if you supply an array as the
second argument to it

-Original Message-
From: Darren Gamble [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 3:58 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


Good day,

exec() isn't very good at capturing output.  It will only return the last
line of output, which is designed mostly to capture error conditions.

You would be best off using popen() and attaching a pipe to the output, and
then just read from the pipe.  More information can be found about popen()
with PHP's documentation.

Try that instead.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 12:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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

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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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




RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Rick Emery

exec() can capture ALL output from a command if you supply an array as the
second argument to it

-Original Message-
From: Darren Gamble [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 3:58 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


Good day,

exec() isn't very good at capturing output.  It will only return the last
line of output, which is designed mostly to capture error conditions.

You would be best off using popen() and attaching a pipe to the output, and
then just read from the pipe.  More information can be found about popen()
with PHP's documentation.

Try that instead.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 12:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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

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

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




RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Darren Gamble

Good day,

exec() isn't very good at capturing output.  It will only return the last
line of output, which is designed mostly to capture error conditions.

You would be best off using popen() and attaching a pipe to the output, and
then just read from the pipe.  More information can be found about popen()
with PHP's documentation.

Try that instead.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 12:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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

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




RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread heinisch

At 25.03.2002  14:26, you wrote:
>
>Perhaps it is how I am calling the $lines in a while loop.?  I have tried
>`$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array),
>system(), shell_exec().  None of them let me capture the STDOUT from the
>program.  There has to be a way to do this.   Anyone?
>
>Thanx
>
>exec()
>
>
>I just realized why nothing I was trying for the regular expressions wasn't
>working.  The command I am running is a C program on the command line of a
>Linux box.  I can't capture the output, it just gets output onto the screen.
>I just echo'd $output after the command was run and it was empty.  Any
>ideas?

even if think your output must come to $output,
an alternative, whenever not so elegant is
exec("your_program_name > tmp.file");
the output will be redirected '>' to the file tmp.file.
then you can open the file using the known fopen(*) command,
and read, processed conventional.
HTH Oliver


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




RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Rick Emery

Do this.

Execute the command at the command line and re-direct output to a file: xxx.

Open file xxx with an editor, such as vi.  Is there a blank line, or line
with JUST a carriage-return (\n) as the last line?

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 3:09 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


No.  I think there is a carriage return (\n), but there is not a blank line
at the end.

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 3:07 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

When the exec'd program executes from the command line, does it output a
blank line as its last line?

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -----Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain pr

RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy

No.  I think there is a carriage return (\n), but there is not a blank line
at the end.

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 3:07 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:    RE: [PHP] Regular Expressions?  Help!

When the exec'd program executes from the command line, does it output a
blank line as its last line?

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To:     'Walker, Roy'
Subject:RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immed

RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Rick Emery

When the exec'd program executes from the command line, does it output a
blank line as its last line?

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-----Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this trans

RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy

Sorry.  Yes. It looks exactly like it should.  And I see the ouput from the
command like it should on the screen, I just can't capture it in the script.

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:59 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:    RE: [PHP] Regular Expressions?  Help!

Again, I ask:

Does $mycmd contain the command you expect to see
$mycmd = "$prog $cmdline $trimline &";
print $mycmd;
$output = exec($mycmd);


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:56 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


The cmd is running running correctly as I see the output on the screen (this
is being run from a command line).  The command output is seen on the screen
and nothing gets set to $output.

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:50 PM
To:     'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

exec() works for me.

Remember, though, it returns only the LAST line.  Have you tried the
following to ensure it's constructing the command you think it is:

$mycmd = "$prog $cmdline $trimline &";
print $mycmd;
$output = exec($mycmd);

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:27 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


Perhaps it is how I am calling the $lines in a while loop.?  I have tried
`$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array),
system(), shell_exec().  None of them let me capture the STDOUT from the
program.  There has to be a way to do this.   Anyone?

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:07 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

exec()

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-----
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:    RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are 

RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Rick Emery

Again, I ask:

Does $mycmd contain the command you expect to see
$mycmd = "$prog $cmdline $trimline &";
print $mycmd;
$output = exec($mycmd);


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:56 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


The cmd is running running correctly as I see the output on the screen (this
is being run from a command line).  The command output is seen on the screen
and nothing gets set to $output.

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:50 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

exec() works for me.

Remember, though, it returns only the LAST line.  Have you tried the
following to ensure it's constructing the command you think it is:

$mycmd = "$prog $cmdline $trimline &";
print $mycmd;
$output = exec($mycmd);

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:27 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


Perhaps it is how I am calling the $lines in a while loop.?  I have tried
`$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array),
system(), shell_exec().  None of them let me capture the STDOUT from the
program.  There has to be a way to do this.   Anyone?

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:07 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

exec()

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-----
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:    RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you.

RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy

The cmd is running running correctly as I see the output on the screen (this
is being run from a command line).  The command output is seen on the screen
and nothing gets set to $output.

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:50 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:    RE: [PHP] Regular Expressions?  Help!

exec() works for me.

Remember, though, it returns only the LAST line.  Have you tried the
following to ensure it's constructing the command you think it is:

$mycmd = "$prog $cmdline $trimline &";
print $mycmd;
$output = exec($mycmd);

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:27 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


Perhaps it is how I am calling the $lines in a while loop.?  I have tried
`$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array),
system(), shell_exec().  None of them let me capture the STDOUT from the
program.  There has to be a way to do this.   Anyone?

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:07 PM
To:     'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

exec()

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you ar

RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Rick Emery

exec() works for me.

Remember, though, it returns only the LAST line.  Have you tried the
following to ensure it's constructing the command you think it is:

$mycmd = "$prog $cmdline $trimline &";
print $mycmd;
$output = exec($mycmd);

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:27 PM
To: 'Rick Emery'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


Perhaps it is how I am calling the $lines in a while loop.?  I have tried
`$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array),
system(), shell_exec().  None of them let me capture the STDOUT from the
program.  There has to be a way to do this.   Anyone?

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:07 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

exec()

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -----Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


**

RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy

Perhaps it is how I am calling the $lines in a while loop.?  I have tried
`$cmd`, exec(), exec($cmd, $ouput) (to capture the output as an array),
system(), shell_exec().  None of them let me capture the STDOUT from the
program.  There has to be a way to do this.   Anyone?

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 2:07 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:    RE: [PHP] Regular Expressions?  Help!

exec()

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in l

RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Rick Emery

exec()

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 2:05 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Regular Expressions? Help!


I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:        RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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

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




RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy

I just realized why nothing I was trying for the regular expressions wasn't
working.  The command I am running is a C program on the command line of a
Linux box.  I can't capture the output, it just gets output onto the screen.
I just echo'd $output after the command was run and it was empty.  Any
ideas?

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:54 PM
To: 'Walker, Roy'
Subject:    RE: [PHP] Regular Expressions?  Help!

well, ya might try:
$my_array = explode( "\" ",$output);

this would set:
$my_vars[0] = "variable1:\"some text info\""
$my_vars[1] = "variable2:\"some text info\""

then, you can do an explode on each of the my_vars

another, which might work:


WHEN EXECUTED DISPLAYS THIS:

C:\>php -q zz.php\
output = variable1:"some information" variable2:"some information"
variable1:"some information" variable2:"some information" - 0
variable1 - 1
some information - 2
variable2 - 3
some information - 4

-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:31 PM
To: 'Rick Emery'
Subject: RE: [PHP] Regular Expressions? Help!


There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-----Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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




RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy

There will be a specific number of variables returned.  I just wanted to set
all the output to a string and just run through it to grab the variables.

Thanx

 -Original Message-
From:   Rick Emery [mailto:[EMAIL PROTECTED]] 
Sent:   Monday, March 25, 2002 1:28 PM
To: 'Walker, Roy'; '[EMAIL PROTECTED]'
Subject:    RE: [PHP] Regular Expressions?  Help!

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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




RE: [PHP] Regular Expressions? Help!

2002-03-25 Thread Rick Emery

With there be a specifc number of variables returne?  Or can the number of
variables vary?


-Original Message-
From: Walker, Roy [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 1:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Regular Expressions? Help!


I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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

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




[PHP] Regular Expressions? Help!

2002-03-25 Thread Walker, Roy

I am trying to do a match for an expression and it to a variable from the
output of a command: 



How can look through $output to set the information returned as different
variables the output would look like:
variable1:"some information" variable2:"some information"

I want to set each variable to a string and write it to a file.

Thank You for you help.
Roy


** PLEASE NOTE **
This E-Mail/telefax message and any documents accompanying this transmission
may contain privileged and/or confidential information and is intended
solely for the addressee(s) named above.  If you are not the intended
addressee/recipient, you are hereby notified that any use of, disclosure,
copying, distribution, or reliance on the contents of this E-Mail/telefax
information is strictly prohibited and may result in legal action against
you. Please reply to the sender advising of the error in transmission and
immediately delete/destroy the message and any accompanying documents.
Thank you. 


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