Here is one shot, but assume you can read in one line at a time. If not, then  
will try another way:

Code starts below:

#!perl -w
my @Array = ();
while ( <DATA> ) {
   chomp;
   if ( m#^\{*(/node:sys\d/app.+:\w+\s+\w+/)#i ) {
      push ( @Array , $1 );
    }
 }
my $MyId = 0;
foreach ( @Array ) {
   printf "%2d: %-s\n", $MyId++, $_;
 }
__DATA__
{/Node:sys1/Application:test appl/
/Node:sys1/Application:test app2/
/Node:sys2/Application:new name/
{/Node:sys2/Application:other name/
/Node:sys2/Application:other name2/

^---- Code ends here

Output:

 0: /Node:sys1/Application:test appl/
 1: /Node:sys1/Application:test app2/
 2: /Node:sys2/Application:new name/
 3: /Node:sys2/Application:other name/
 4: /Node:sys2/Application:other name2/



-----Original Message-----
From: Families Laws [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 01, 2001 19:23
To: [EMAIL PROTECTED]
Subject: How to use reg-exp to parse


I have a character string that looks like:

{/Node:sys1/Application:test appl/
/Node:sys1/Application:test app2/
/Node:sys2/Application:new name/
{/Node:sys2/Application:other name/
/Node:sys2/Application:other name2/

I cannot figure out how to write a reg-exp to parse
them into strings such as:

array[0] = "/Node:sys1/Application:test app1/";
array[1] = "/Node:sys1/Application:test app2/";
array[2] = "/Node:sys2/Application:new name/";
array[3] = "/Node:sys2/Application:other name/";
array[4] = "/Node:sys2/Applicatoin:other name2/";

Any help is appreciated.  Thanks in advance.
  

__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to