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/


Reply via email to