Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!rutgers!mcnc!uvaarpa!mmdf From: clindh@abalon.se (Christer Lindh) Newsgroups: comp.lang.perl Subject: how to avoid splitting on an escaped delimiter? Message-ID: <1990Jun5.181002.3453@uvaarpa.Virginia.EDU> Date: 5 Jun 90 18:10:02 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: clindh@abalon.se Organization: The Internet Lines: 20 I want to split up a string using several possible delimiters, and keep the delimiters in the array. The manual says that split(/([,-])/, "1-10,20") gives (1, '-', 10, ',', 20) This works just fine, but how can I AVOID splitting on a delimiter escaped with backslash? Ie a split on "1\-10,20" should give ('1\-10', ',', 20). Has anyone out there got a smart one/many-liner to use in this case? (I know how to remove the remaining backslashes, for example with grep(s/\\(.)/\1/g, @array) ) - clindh@abalon.se :: o/ _ _ _ _ _ __ ! Abalon AB, Stockholm, Sweden :: /@ ! ! ! !\/! !_! ! ::