sharanbas raghapur wrote:
> Hi all,
>
> I would like to extract part of string from another string.
>
> The input string is always going to be of the format
> print "word1 word2 word3 ......"
>
> I would like to extract whatever exists between print " and then then
> following "
> (word1 word2 word3 in the above case)
> The number of words that would occur in the print cannot be predicted.
>
> Please suggest a regex for this.....
$_ = 'print "word1 word2 word3 ......"';
my ($str) = /print\s+"(.*)"/; # may suck an embedded "
print $str, "\n";
or slightly different REs to try:
/print\s+([^"]+)"/ # to avoid embedded "
/print\s+(.*?)"/ # ditto
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (Free site for Perl/Lakers)
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs