Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Feb 2001 10:43:07 +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:  <20010209104306.F62745@d9168.upc-d.chello.nl>
In-Reply-To: <20010209160849.A97806@office.naver.co.id>; from john@office.naver.co.id on Fri, Feb 09, 2001 at 04:08:49PM %2B0700
References:  <20010209160849.A97806@office.naver.co.id>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010209104306.F62745>