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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse sfpug by date

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