You want to capture character "?" means zero or one time repetition. To disable the effect of such characters use \Q & to enable the effect use \E.
So try $array[3]=~/[M|T|W|TR|F]\s[M|T|W|TR|F]\s(.*\Q?\E)/; If this doesn't work send the entire string from which you want to capture & what to capture? Thanks & Regards, Sanket Vaidya Patni Computer Systems Limited -----Original Message----- From: Manasi Bopardikar [mailto:[EMAIL PROTECTED] Sent: Friday, July 18, 2008 9:52 AM To: 'sanket vaidya' Subject: RE: Extract the desired value from a regex Can you please explain it a little more/ -----Original Message----- From: sanket vaidya [mailto:[EMAIL PROTECTED] Sent: Friday, July 18, 2008 9:47 AM To: 'Manasi Bopardikar' Cc: beginners@perl.org Subject: RE: Extract the desired value from a regex $1 does not work because you are using metacharacter "?" in regex. Use \Q & \E to capture. Thanks & Regards, Sanket Vaidya Patni Computer Systems Limited A 78/9, GIDC, Electronics Estate Sector - 25, Gandhinagar - 382 016 Gujarat, India Tel: 91-79-23240905 Ext: 243 -----Original Message----- From: Manasi Bopardikar [mailto:[EMAIL PROTECTED] Sent: Friday, July 18, 2008 9:22 AM To: beginners@perl.org Subject: Extract the desired value from a regex Hi, 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.Is there any way to do it. -I tried $1 does not work.Why doesn't it work I do not understand. Is there any other way to do it. Thanks and Regards, Manasi Bopardikar|s/w Engineer|Persistent SystemsLtd (+91)(020)(30234497)|9767218759 [EMAIL PROTECTED] DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. http://www.patni.com World-Wide Partnerships. World-Class Solutions. _____________________________________________________________________ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _____________________________________________________________________ DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. http://www.patni.com World-Wide Partnerships. World-Class Solutions. _____________________________________________________________________ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _____________________________________________________________________ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/