184 local res = {} |
184 local res = {} |
185 for _,p in ipairs(patterns) do |
185 for _,p in ipairs(patterns) do |
186 local match = {s:find(p, index)} |
186 local match = {s:find(p, index)} |
187 if #match>0 and (#res==0 or match[1] < res[1]) then res = match end |
187 if #match>0 and (#res==0 or match[1] < res[1]) then res = match end |
188 end |
188 end |
189 return unpack(res) |
189 return table.unpack(res) |
190 end |
190 end |
191 |
191 |
192 -- If a replacement array is specified, the range [start, stop] in the array is replaced |
192 -- If a replacement array is specified, the range [start, stop] in the array is replaced |
193 -- with the replacement array and the resulting array is returned. Without a replacement |
193 -- with the replacement array and the resulting array is returned. Without a replacement |
194 -- array the section of the array between start and stop is returned. |
194 -- array the section of the array between start and stop is returned. |