From owner-freebsd-questions Fri Feb 9 1:43:30 2001 Delivered-To: freebsd-questions@freebsd.org Received: from d9168.upc-d.chello.nl (d9168.upc-d.chello.nl [213.46.9.168]) by hub.freebsd.org (Postfix) with ESMTP id BC6B837B65D for ; Fri, 9 Feb 2001 01:43:12 -0800 (PST) Received: by d9168.upc-d.chello.nl (Postfix, from userid 1001) id 0D6AB64; Fri, 9 Feb 2001 10:43:07 +0100 (CET) Date: Fri, 9 Feb 2001 10:43:07 +0100 From: Edwin Groothuis To: John Indra Cc: freebsd-questions@freebsd.org Subject: Re: Crafting Perl RE... Message-ID: <20010209104306.F62745@d9168.upc-d.chello.nl> Mail-Followup-To: Edwin Groothuis , John Indra , freebsd-questions@freebsd.org References: <20010209160849.A97806@office.naver.co.id> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010209160849.A97806@office.naver.co.id>; from john@office.naver.co.id on Fri, Feb 09, 2001 at 04:08:49PM +0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Feb 09, 2001 at 04:08:49PM +0700, John Indra wrote: > Hi... > > Simple question but I don't know the answer. Suppose I have this string: > somefile.ins.jpg. I want to craft a Perl RE so it captures the jpg part. I > try this RE: > > $string =~ m#\.(.*)$# Something like: [~] edwin@kludge>perl -e '$s="blaat.test.jpg";$s=~/\.(\w+)$/; print $1,"\n"' jpg [~] edwin@kludge>perl -e '$s="blaat.testjpg";$s=~/\.(\w+)$/; print $1,"\n"' testjpg [~] edwin@kludge>perl -e '$s="blaattestjpg";$s=~/\.(\w+)$/; print $1,"\n"' Edwin -- Edwin Groothuis | Interested in MUDs? Visit Fatal Dimensions: mavetju@chello.nl | http://fataldimensions.nl.eu.org/ ------------------+ telnet://fataldimensions.nl.eu.org:4000 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message