local stdnse = require "stdnse"
local find = (require "string").find
_ENV = stdnse.module("match", stdnse.seeall)
numbytes = function(num)
  local n = num
  return function(buf)
    if(#buf >=n) then
      return n, n
    end
    return nil
  end
end
pattern_limit = function (pattern, within)
  local n = within
  return function(buf)
    local left, right = find(buf, pattern)
    if left then
      return left, right
    elseif #buf >= n then
      return n, n
    end
    return nil
  end
end
return _ENV;
