OT: regex pattern problem

Iain Buchanan iain at pcorp.com.au
Wed Jan 7 04:20:48 UTC 2004


On Wed, 2004-01-07 at 13:26, Craig Tinson wrote:
> guys.. regex patterns are a *complete* mystery so am hoping someone can 
> help with one..

perl has some good regex tutorials.  man perlretut and man perlrequick
(I think) should get you slightly more familiar.

> I have to find all entries in a file which match the following:
> 
> (pg. 2)
> (pg. 210)
> (pg. 211)
> (pg. 309)
> (pg. 4000)
> 
> etc etc
> 
> what regex pattern would I use?

It depends on what program you're using thats asking for the regex. 
perl, emacs, grep, less?

\(pg[.] [\d]+\)
would probably work in perl, whereas
(pg[.] [0-9]+) would probably work in emacs.

And don't forget to read up on regex's.  Once you've grasped them,
you'll start doing everything with regex's!

HTH,
-- 
Iain Buchanan <iain at pcorp.nospam.com.au>

Remember, UNIX spelled backwards is XINU.
		-- Mt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20040107/3b98f067/attachment-0001.sig>


More information about the fedora-list mailing list