<commit_before>class Regexp
  `def._isRegexp = true`

  def self.escape(string)
    `string.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\^\\$\\|]/g, '\\\\$&')`
  end

  def self.union(*parts)
    `new RegExp(parts.join(''))`
  end

  def self.new(regexp, options = undefined)
    `new RegExp(regexp, options)`
  end

  def ==(other)
    `other.constructor == RegExp && self.toString() === other.toString()`
  end

  def ===(str)
    if `str._isString == null` && str.respond_to?(:to_str)
      str = str.to_str
    end

    if `str._isString == null`
      return false
    end

    `self.test(str)`
  end

  def =~(string)
    if `string === nil`
      $~ = $` = $' = nil<commit_msg>Escape spaces in Regexp.escape<commit_after>class Regexp
  `def._isRegexp = true`

  def self.escape(string)
    `string.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\^\\$\\| ]/g, '\\\\$&')`
  end

  def self.union(*parts)
    `new RegExp(parts.join(''))`
  end

  def self.new(regexp, options = undefined)
    `new RegExp(regexp, options)`
  end

  def ==(other)
    `other.constructor == RegExp && self.toString() === other.toString()`
  end

  def ===(str)
    if `str._isString == null` && str.respond_to?(:to_str)
      str = str.to_str
    end

    if `str._isString == null`
      return false
    end

    `self.test(str)`
  end

  def =~(string)
    if `string === nil`
      $~ = $` = $' = nil
{'fraction_non_alphanumeric': 0.23819742489270387, 'fraction_numerical': 0.0, 'mean_word_length': 2.238425925925926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7444409', 'n_tokens_mistral': 564, 'n_tokens_neox': 535, 'n_words': 105}