Here is the problem. I have various queries stored which grab different information from the database. Associated with each query is some text. This text is different for each query. In this text is information that tell which fields to show and where.
an example of this text would be
$text = "please show this field [[showfield4]] and then show this field [[showfield5]]";
When the query runs say it finds 10 matches. the info in these fields is different for each match.
What I want to do is do a regular expression that will search this text and replace the [[showfield3]] with $alert[3]
This is what I currently have but doesn't work.
while (@alert = $run_ealert->fetchrow_array) {
$temp_text = $ealert_text;
for ($c = 0; $c <= $#alert; $c++) {
$temp_text =~ s/[[showfield$c]]/$alert[$c]/g;
print $temp_text;
I'm not getting a match.
Any help would be greatly appreciated.
Thanks in advance.
an example of this text would be
$text = "please show this field [[showfield4]] and then show this field [[showfield5]]";
When the query runs say it finds 10 matches. the info in these fields is different for each match.
What I want to do is do a regular expression that will search this text and replace the [[showfield3]] with $alert[3]
This is what I currently have but doesn't work.
while (@alert = $run_ealert->fetchrow_array) {
$temp_text = $ealert_text;
for ($c = 0; $c <= $#alert; $c++) {
$temp_text =~ s/[[showfield$c]]/$alert[$c]/g;
print $temp_text;
I'm not getting a match.
Any help would be greatly appreciated.
Thanks in advance.