Wouldn't this transpose the second word and the first word also?
-----Original Message----- From: Nikola Janceski [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 24, 2002 1:25 PM To: 'Naveen Parmar'; [EMAIL PROTECTED] Subject: RE: Pattern matching [^ ]+ (means match one or more charaters that is not a space (literal " ") s/^([^ ]+) +([^ ]+)/$2 $1/; reads s/ Substitute, ^ that which begins the string with ([^ ]+) one or more charaters that is not a space (store in $1) + one or more charaters that IS a space ([^ ]+) one or more charaters that is not a space (store in $2) / with $2 $1 / end Substitute; so that would take: $string = "dsljfsldj lsjdkfldjlf lsdkjflkdjssdlf jslj lk sf"; $string =~ s/^([^ ]+) +([^ ]+)/$2 $1/; $string is now "dsljfsldj lsjdkfldjlf lsdkjflkdjssdlf jslj lk sf" nothing would happen if string started with a space. -----Original Message----- From: Naveen Parmar [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 24, 2002 4:16 PM To: [EMAIL PROTECTED] Subject: Pattern matching What is the purpose of using [^"] in the following expression: s/^([^ ]+) +([^ ]+)/$2 $1/; _________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -------------------------------------------------------------------------------- This email may contain confidential and privileged material for the sole use of the intended recipient. If you are not the intended recipient, please contact the sender and delete all copies. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]