in reply to Re: Re: Linking words in html to glossary.
in thread Linking words in html to glossary.

Ahhh, okay. Sorry about that. If you look at my reply in that node, I mention a method that uses a negative lookahead. Play around with it a little. And as always, read perlre :o)
  • Comment on Re: Re: Re: Linking words in html to glossary.

Replies are listed 'Best First'.
Re: Re: Re: Re: Linking words in html to glossary.
by PerlStalker (Initiate) on Jul 21, 2001 at 01:51 UTC

    Yeah. Now that I've looked at it a bit more, something kinda like this should work:

    $file =~ s/(\s+)($word)([\.\?\!]?\s+).*?(?!</a>)/"$1<a href=\"".$gloss +ary{$word}{'link'}."\">$2<\/a>$3"/eig;

    The .*(?!</a>) should then say that the engine will match the word plus (optionally) stuff after it unless that mess is ended by a </a>.

    PerlStalker