-- parentheses in a pattern capture sub-parts local date = "2026-09-23" local year, month, day = string.match(date, "(%d+)-(%d+)-(%d+)") print(year, month, day)
string.match returns captured groups