Thanks Rob. It really helped. I got what I want. Request you to please explain me in detail how you did this.
I did not understand much. Please guide. Regards Irfan. -----Original Message----- From: Rob Dixon [mailto:[EMAIL PROTECTED] Sent: Thursday, December 13, 2007 6:21 PM To: beginners@perl.org >> Perl Beginners Cc: Sayed, Irfan (Irfan) Subject: Re: Help on regular expression Sayed, Irfan (Irfan) wrote: > Hi All, > > I have a string like this > > CLEARCASE_CMDLINE = (mkact -nc notme sprint) Now with the regular > expression what I want is only those characters before closing braces > excluding white space character. I mean to say that if regular > expression encounter the white space character then it should stop. > So my output should come as sprint. Does the program below do what you need? HTH, Rob use strict; use warnings; my $str = 'CLEARCASE_CMDLINE = (mkact -nc notme sprint)'; $str =~ /(\S+)\s*\)/ or die "String didn't match expected pattern"; my $word = $1; print "Word found is '$word'\n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/