From owner-freebsd-questions Fri Feb 9 2:33:15 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 BA98E37B401 for ; Fri, 9 Feb 2001 02:32:58 -0800 (PST) Received: by d9168.upc-d.chello.nl (Postfix, from userid 1001) id 1601C215; Fri, 9 Feb 2001 11:32:57 +0100 (CET) Date: Fri, 9 Feb 2001 11:32:57 +0100 From: Edwin Groothuis To: John Indra Cc: freebsd-questions@freebsd.org Subject: Re: Crafting Perl RE... Message-ID: <20010209113257.G62745@d9168.upc-d.chello.nl> Mail-Followup-To: Edwin Groothuis , John Indra , freebsd-questions@freebsd.org References: <20010209160849.A97806@office.naver.co.id> <20010209104306.F62745@d9168.upc-d.chello.nl> <20010209171254.A34759@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: <20010209171254.A34759@office.naver.co.id>; from john@office.naver.co.id on Fri, Feb 09, 2001 at 05:12:54PM +0700 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Feb 09, 2001 at 05:12:54PM +0700, John Indra wrote: > >[~] edwin@kludge>perl -e '$s="blaat.test.jpg";$s=~/\.(\w+)$/; print $1,"\n"' > >jpg > > So the RE is /\.(\w)$/ > Hmm... I am not using this from the first place to anticipate "extensions > that has weird characters", say: > > $string = "test.w?g" [~] edwin@kludge>perl -e '$s="blaat.test.j?g";$s=~/^.*\.(.*)$/; print $1,"\n"' j?g You're lucky that ^.* is greedy :-) 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