question of regular expression
I have one line like this: $command = '$ldapsearch -x -LLL -h "cds2.ford.com" -b "ou=People, o=Ford,c=US" "uid=$login" uid fordUNIXid'; If condition { $command = '$ldapsearch -LLL -h "cds2.ford.com" -b "ou=People, o=Ford,c=US" "uid=$login" uid fordUNIXid' # which -x need to remove } Could anyone let me know by using regular _expression_, how can I get rid of "-x"? Thanks in advance! Lixin Do you Yahoo!? Express yourself with Y! Messenger! Free. Download now.___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: question of regular expression
Could anyone let me know by using regular expression, how can I get rid of -x? If that's all you really want, and you know that's the only place it can occur, then its no problem to use just s/-x/''/; (substitute '-x' by '') ed c ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: question of regular expression
i wrote, obviously with my eyes closed: s/-x/''/; which of course should be s/-x//; - sorry! ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: a question of regular expression
This sounds like the perfect time for a split() my($var1,$var2) = split /#/,$line; perldoc -f split -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 18, 2002 7:49 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: a question of regular expression Dear all, I have a line like this: notepad test.txt # This is a test. I want to put seprate the line into two by #, like var1 = notepad test.txt var2 = This is a test. (I do not want to include # sign) How can I do? Thanks a lot inadvance! Lixin ___ Perl-Win32-Admin mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
a question of regular expression
Dear all, I want to open a directory and get all sub folders except . and .. under directory, how can I do it? Thanks Lixin ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: a question of regular expression
I am sorry, I do not make it clear. The code is like: opendir (DIR, $directory) || die can not open it:$!; @sub_folders = readdir($directory); can I do something on the second line to make @sub_folders not include . and ..? Thanks Lixin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 15, 2001 4:36 PM To: [EMAIL PROTECTED] Subject: a question of regular expression Dear all, I want to open a directory and get all sub folders except . and .. under directory, how can I do it? Thanks Lixin ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: a question of regular expression
opendir (DIR, $directory) || die can not open it:$!; @sub_folders = grep $_ !~ /^\.+$/, readdir($directory); Peter Guzis Web Administrator, Sr. ENCAD, Inc. email: [EMAIL PROTECTED] www.encad.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 15, 2001 1:42 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: a question of regular expression I am sorry, I do not make it clear. The code is like: opendir (DIR, $directory) || die can not open it:$!; @sub_folders = readdir($directory); can I do something on the second line to make @sub_folders not include . and ..? Thanks Lixin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 15, 2001 4:36 PM To: [EMAIL PROTECTED] Subject: a question of regular expression Dear all, I want to open a directory and get all sub folders except . and .. under directory, how can I do it? Thanks Lixin ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
RE: a question of regular expression
@sub_folders = grep !/^\.\.?$/, readdir (DIR); 1) you need to send in the directory handle (DIR) not the directory name 2) you can use grep to pull out the . and .. This does work on windows. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 15, 2001 3:42 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: a question of regular expression I am sorry, I do not make it clear. The code is like: opendir (DIR, $directory) || die can not open it:$!; @sub_folders = readdir($directory); can I do something on the second line to make @sub_folders not include . and ..? Thanks Lixin -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, October 15, 2001 4:36 PM To: [EMAIL PROTECTED] Subject: a question of regular expression Dear all, I want to open a directory and get all sub folders except . and .. under directory, how can I do it? Thanks Lixin ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users