class Fluent::Plugin::RegexpParser
def configure(conf)
def configure(conf) super # For compat layer if @ignorecase || @multiline options = 0 options |= Regexp::IGNORECASE if @ignorecase options |= Regexp::MULTILINE if @multiline @expression = Regexp.compile(@expression.source, options) end @regexp = @expression # For backward compatibility if @expression.named_captures.empty? raise Fluent::ConfigError, "No named captures in 'expression' parameter. The regexp must have at least one named capture" end end
def parse(text)
def parse(text) m = @expression.match(text) unless m yield nil, nil return end r = {} m.names.each do |name| if value = m[name] r[name] = value end end time, record = convert_values(parse_time(r), r) yield time, record end