Hi All, I am writing a program to display POD, functions, Perl FAQ, and programs and want to impement two rules for the input: 1. it is Perl module names if the input starts with words or '-m'; 2. it is Perl function, FAQ, or program name if it starts with -f, -q, or -p respectively. Here is the test program that I used to test the codes to parse out the input. I have problem to implement Rule two if there is '-' in the server name or file names. Could you help me - you RE and Perl experts! Hanming # more tst70.pl #!/usr/local/bin/perl # use strict; use warnings; my $inp='Carp Text::ParseWords -f stat qr '; $inp .= '-m CGI DBI -f open readdir '; $inp .= '-q "send mail:mail address:parse" '; $inp .= '-p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv '; $inp .= '-f lc uc '; my $re1 = qr((-m\s*)?[\w: ]+); my $re2 = qr(-[fpmq]\s+); my $re3 = qr([\w:"'\/\s]+); my $i = 0; while ($inp) { ++$i; if ($inp =~ /^($re1)/) { print "\nMatch: $&\n Pre: $`\n Post: $'\n"; $inp = $'; } if ($inp =~ m{^($re2)($re3)\s+($re2)?}) { print "\n 1st: $1\n 2nd: $2\n 3rd: $3\n"; print "Match: $&\n Pre: $`\n Post: $'\n"; $inp = "$3$'"; } print "Input $i: $inp\n"; $inp = "" if ($i > 9); } #> ./tst70.pl Match: Carp Text::ParseWords Pre: Post: -f stat qr -m CGI DBI -f open readdir -q "send mail:mail address:parse" -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc 1st: -f 2nd: stat qr 3rd: -m Match: -f stat qr -m Pre: Post: CGI DBI -f open readdir -q "send mail:mail address:parse" -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 1: -m CGI DBI -f open readdir -q "send mail:mail address:parse" -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Match: -m CGI DBI Pre: Post: -f open readdir -q "send mail:mail address:parse" -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc 1st: -f 2nd: open readdir 3rd: -q Match: -f open readdir -q Pre: Post: "send mail:mail address:parse" -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 2: -q "send mail:mail address:parse" -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc 1st: -q 2nd: "send mail:mail address:parse" 3rd: -p Match: -q "send mail:mail address:parse" -p Pre: Post: df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 3: -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 4: -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 5: -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 6: -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 7: -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 8: -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 9: -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc Input 10: -p df-svr1:/tmp/myfile.txt df-svr2:/tmp/myfile.csv -f lc uc -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]