Lua syntax, it's from one of my WoW addons:
PHP Code:
msg = gsub(msg, "^|Hchannel:(%S+)|h%[([%d%.%s]*)([^%]]+)%]|h ", "|Hchannel:%1|h" .. channelFormat .. "|h ");
Basically, this replaces the display format of the channel escape sequence (WoW stuff) at the start of the string
msg (if any escape sequence exists) with a predefined new format stored in
channelFormat.
WoW channel escape sequences work like this:
PHP Code:
|Hchannel:CHANNEL_HERE|hCHANNEL_DISPLAY_NAME_HERE|h
If you want to know some more details, either ask, or check out patterns on the Lua website. Also, as far as I know, Lua implements regular expressions a tad differently compared to other languages, so you might also want to check out the PHP documentation.