l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
October 7: Social gathering
Next Installfest:
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2001 Dec 30 16:57

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] newbie regexp question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] newbie regexp question

  • Subject: Re: [vox-tech] newbie regexp question
  • From: Micah Cowan <micah@cowanboxMAPS.com>
  • Date: Thu, 28 Sep 2000 13:51:48 -0700
  • References: 39D3A735.F5C448BB@sagresdiscovery.com
  • References: 86zoksw961.fsf@

On Thu, Sep 28, 2000 at 01:31:18PM -0700, Ricardo Anguiano wrote:
> Eric Engelhard <ekengelhard@sagresdiscovery.com> writes:
> > Hi all,
> > 
> > I am writing a perl script to process DNA sequences and want to use
> > regular expressions to mark a site at known landmarks (exact sequence
> > match) and cut the sequence both before AND after these landmarks. I
> > promise to whip out the regexp O'Reilly book tonight, but I need a
> > demo up in a couple hours. First correct answer scores a pint of hony
> > beer (12% alcohol).
> > 
> > -- Eric K. Engelhard
> Will this work?  Keep the beer if it does.
> #!/usr/bin/perl
> while (<>) {
> chomp;
> if (/(.*)(exactSequence)(.*)/) {
>     $beforematch = $1;
>     $match = $2;
>     $aftermatch = $3;
> }
> -Ricardo


undef $/;       # slurp the file into a scalar
$contents = <>;
$contents =~ /$exactSequence/;
$beforeMatch = $`;
$match = $&;
$afterMatch = $';

- Micah

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.