Skip to content

Instantly share code, notes, and snippets.

@X-Raym
Created January 26, 2018 14:58
Show Gist options
  • Select an option

  • Save X-Raym/9b77847c0864355f8ae99bc27915766e to your computer and use it in GitHub Desktop.

Select an option

Save X-Raym/9b77847c0864355f8ae99bc27915766e to your computer and use it in GitHub Desktop.
String Match with Captures Count
text = [[reaper.ShowConsoleMsg( reaper.GetActiveTake( reaper.GetItem(0,0) ) ) )]]
local captures = {}
for capture in string.gmatch(text, "reaper%.([%w|%d]+)") do
if not captures[capture] then captures[capture] = 0 end
captures[capture] = captures[capture] + 1
end
for k, v in pairs( captures ) do
print( k .. " = " .. v)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment