Manasi Bopardikar wrote:
Hi,

Hello,

I have a regex --- $array[3]=~/[M|T|W|TR|F]\s[M|T|W|TR|F]\s(.*?)/;

I want to extract the value of expression highlighted in red.

My email reader only displays black text on a white background, there is no "red" here. If you could show us the actual pattern you want to capture then maybe we could help you. By the way, the character class [M|T|W|TR|F] could be written more simply as [|MTWRF], the duplicate characters are ignored. Perhaps you meant to use alternation instead in which case you want (?:M|T|W|TR|F).


Is there any way to do it.

-I tried $1 does not work.Why doesn't it work I do not understand.

$1 contains the string captured by (.*?) which is zero-width and non-greedy so it will usually have the value ''.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to