Skip site navigation (1) Skip section navigation (2)

Regular Expression Help?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: SF Postgres <sfpug(at)postgresql(dot)org>
Subject: Regular Expression Help?
Date: 2003-11-05 00:35:45
Message-ID: 200311041635.45965.josh@agliodbs.com (view raw or flat)
Thread:
Lists: sfpug
Perl geeks,

I'd like to write a regular expression for the following purpose:

In an incoming string, there are 0-1 instances of each of #NAME, #DATE, and 
#DETAIL.   I'd like to replace these labels in the string with the contents 
of their corresponding variable, $ename, $mdate, $edetail (which are coming 
from the database)

I believe that this is possible to do in a single regular expression, but I'm 
not clear on how.  Currently, I'm doing 3 substitutions, along the lines of:

$eline =~ s/#NAME/$ename/g;

But that's not very sophisticated and I'd like to improve my use of regexp.  
Suggestions?

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


Responses

sfpug by date

Next:From: David FetterDate: 2003-11-05 00:47:59
Subject: Re: Regular Expression Help?
Previous:From: Josh BerkusDate: 2003-11-04 18:37:08
Subject: Offer for anyone managing a medium-large network

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group