Date: Fri, 9 Feb 2001 11:32:57 +0100 From: Edwin Groothuis <mavetju@chello.nl> To: John Indra <john@office.naver.co.id> Cc: freebsd-questions@freebsd.org Subject: Re: Crafting Perl RE... Message-ID: <20010209113257.G62745@d9168.upc-d.chello.nl> In-Reply-To: <20010209171254.A34759@office.naver.co.id>; from john@office.naver.co.id on Fri, Feb 09, 2001 at 05:12:54PM %2B0700 References: <20010209160849.A97806@office.naver.co.id> <20010209104306.F62745@d9168.upc-d.chello.nl> <20010209171254.A34759@office.naver.co.id>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010209113257.G62745>