Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 93374 invoked from network); 30 Jun 2008 11:34:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jun 2008 11:34:42 -0000 Received: (qmail 29602 invoked by uid 500); 30 Jun 2008 11:34:38 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 29586 invoked by uid 500); 30 Jun 2008 11:34:38 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 29575 invoked by uid 99); 30 Jun 2008 11:34:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jun 2008 04:34:38 -0700 X-ASF-Spam-Status: No, hits=4.0 required=10.0 tests=DNS_FROM_OPENWHOIS,FORGED_YAHOO_RCVD,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Jun 2008 11:33:46 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1KDHe2-0006Nn-7l for modperl@perl.apache.org; Mon, 30 Jun 2008 04:34:06 -0700 Message-ID: <18193673.post@talk.nabble.com> Date: Mon, 30 Jun 2008 04:34:06 -0700 (PDT) From: Alexander Burrows To: modperl@perl.apache.org Subject: Re: Some perl regex help In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: alex_v2@yahoo.com References: <18188634.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org This worked great thanks. Was exactly what I was looking for. -Alexander James Smith-7 wrote: > > > > On Sun, 29 Jun 2008, Alexander Burrows wrote: > >> >> Hello again all. Been a while since I've posted here but needed some help >> on >> a regex I was trying to write. >> >> $line =~ tr/(\(|\)|<|>)/(\(|\)|\<|\>)/g; > > Simplest approach is to make a hash of the substitutions and use > an "e" executed regexp > > my %hash = ('('=>'(',')'=>')','<'=>'<','>'=>'>'); > > $line =~ s/([()<>])/$hash{$1}/eg; > >> >> This does not work at all in perl so I found so I replaced the tr with s >> and >> the search part works as expected but the replace does not. I've been >> trying >> to read around forums and regex documents for perl but they seem >> unorganized >> and cryptic. So any help would be appreciated. >> >> -Alexander >> -- >> View this message in context: >> http://www.nabble.com/Some-perl-regex-help-tp18188634p18188634.html >> Sent from the mod_perl - General mailing list archive at Nabble.com. >> >> > > > -- > The Wellcome Trust Sanger Institute is operated by Genome Research > Limited, a charity registered in England with number 1021457 and a > company registered in England with number 2742969, whose registered > office is 215 Euston Road, London, NW1 2BE. > > -- View this message in context: http://www.nabble.com/Some-perl-regex-help-tp18188634p18193673.html Sent from the mod_perl - General mailing list archive at Nabble.com.