The secret, as my fellow monks have pointed out, is using parenthesis to collect the match on the left hand side of the substitution and the special variable $1 to insert that match on the right hand side. Read more about it in perlre.
(Yes, code needs explanation of the mechanics, sometimes.)
In reply to RE: RE: Search Term Highlighting
by chromatic
in thread Search Term Highlighting
by librarygeek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |