cranberry13 has asked for the wisdom of the Perl Monks concerning the following question:
The problem is this..... The program is footnoting some of the words that it finds in the actual 'footnote' text.
Here is an example of the file:
$line = " Jack and jill went up the hill to fetch a pail of water. Jac +k fell down and broke his crown and jill came tumbling after."; $newline = $line; ## MAKE A COPY OF THE LINE @wordlist = (hill,pail,water,down); # THE LIST OF WORDS TO SEARCH FO +R ## FOR EACH WORD IN THE WORDLIST -- FOOTNOTE THE WORD for ($i=0; $i < @wordlist; $i++) { $currword = $wordlist[$i]; $newline =~ s/(\b$currword(?:ed|ing|al)?\b)/\\footnote\{$1 $hash{l +c($1)}{explanation}\}/im; }
And $hash{lc($1)}{explanation} successfully returns the explanation of the current word in @wordlist.
Suppose the definition of 'pail' is:
'A cylindrical vessel with a handle that holds water.'
After my program runs, both the 'water' in the poem and the 'water' in the footnote definition of 'pail' will be footnote (ie. There is a footnote within a footnote)
How do I get it to not footnote the 'water' in the 'pail' definition?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need to modify my reg-expression
by Abigail-II (Bishop) on Nov 06, 2003 at 17:42 UTC | |
|
Re: Need to modify my reg-expression
by flounder99 (Friar) on Nov 06, 2003 at 20:57 UTC | |
|
Re: Need to modify my reg-expression
by delirium (Chaplain) on Nov 06, 2003 at 18:30 UTC |