module Fluent::Compat::StringUtil

Private Class Methods

match_regexp(regexp, string) click to toggle source
# File lib/fluent/compat/string_util.rb, line 20
def match_regexp(regexp, string)
  begin
    return regexp.match(string)
  rescue ArgumentError => e
    raise e unless e.message.index("invalid byte sequence in".freeze).zero?
    $log.info "invalid byte sequence is replaced in `#{string}`"
    string = string.scrub('?')
    retry
  end
  return true
end

Private Instance Methods

match_regexp(regexp, string) click to toggle source
# File lib/fluent/compat/string_util.rb, line 20
def match_regexp(regexp, string)
  begin
    return regexp.match(string)
  rescue ArgumentError => e
    raise e unless e.message.index("invalid byte sequence in".freeze).zero?
    $log.info "invalid byte sequence is replaced in `#{string}`"
    string = string.scrub('?')
    retry
  end
  return true
end