View Single Post
07/13/14, 05:34 PM   #29
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
I find your replacement code quite convoluted Try this:
Lua Code:
  1. link:gsub("|H(%x%x%x%x%x%x)(.-|h)(.-)|h", "|H0%2|h")
  2. -- first capture matches six hex digits, which are discarded
  3. -- second capture matches everything up to and including |h, and is put in replacement %2
  4. -- third capture matches everything up to second |h (link text, discarded)
  5. -- you can use it on old and new links alike, no need to test which format you have
  6. -- on new links it wil just not replace anything, because the |Hxcolor code won't match

edit: oops, somehow I dropped one x from the pattern. fixed

Last edited by merlight : 07/13/14 at 05:39 PM.
  Reply With Quote