I believe you want $2, not $1. Either that or use ?: in the first set of parentheses.
-----Original Message----- From: Florentin Ionescu To: [EMAIL PROTECTED] Sent: 10/4/2001 8:48 PM Subject: regex I am trying to extract "xvar" from a string like $a="la la la set /Y xvar= yval".- the switch /y can exist or not. $a=~s#.*[Ss][Ee][Tt]\s+(\/\w?)\s+(\w+)=.*#$1#; Why doesn't this get "xvar" from $a ? Thank you for participation, Florentin. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]