<commit_before>module AutoHtml
  module Filters
    # transforms url to HTML img tag with URL as value of src attribute
    def auto_html_transform_image(url)
      image = auto_html_match_image(url)
      image && %|<img src="#{image}" alt=""/>|
    end

    # http://stackoverflow.com/questions/169625/regex-to-check-if-valid-url-that-ends-in-jpg-png-or-gif
    def auto_html_match_image(url)
      url[/https?:\/\/(?:[a-z\-]+\.)+[a-z]{2,6}(?:\/[^\/#?]+)+\.(?:jpg|gif|png)/]
    end
  end
end<commit_msg>Changed regexp for matching images. Old one didn't match URL with subdomains<commit_after>module AutoHtml
  module Filters
    # transforms url to HTML img tag with URL as value of src attribute
    def auto_html_transform_image(url)
      image = auto_html_match_image(url)
      image && %|<img src="#{image}" alt=""/>|
    end
    
    def auto_html_match_image(url)
      url[/http:\/\/.+(jpg|gif|png)/]
    end
  end
end
{'fraction_non_alphanumeric': 0.15574650912996776, 'fraction_numerical': 0.008592910848549946, 'mean_word_length': 3.1981981981981984, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '642526', 'n_tokens_mistral': 331, 'n_tokens_neox': 318, 'n_words': 75}