Howto: Enable regular expression highlighting in LimeChat

in LimeChat.app/Contents/Resources/logrenderer.rb around line 419… WFM. IANAL. YMMV. RTFM. OMGWTF. WTL. GTFO. ETC.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    words.each do |w|
      next if w.empty?
      s = body
      offset = 0
# <edit was="rex = Regexp.new(Regexp.escape(w), true)">
      rex = Regexp.new(w, true)
# </edit>
      while rex =~ s
# <edit>
        begin
# </edit>
          left = $~.begin(0)
          right = $~.end(0)
          pre = $~.pre_match
          post = $~.post_match
          ok = true
 
          if exact_word_match
            if !pre.empty? && alphabetic?(w.first_char) && alphabetic?(pre.last_char)
              ok = false
            elsif !post.empty? && alphabetic?(w.last_char) && alphabetic?(post.first_char)
              ok = false
            end
          end
 
          if ok
            keywords < < { :pos => offset+left, :len => right-left }
          end
          s = post
          offset += right
# <edit>
        rescue
          next
        end
# </edit>
      end
    end

2 thoughts on “Howto: Enable regular expression highlighting in LimeChat

    • apokalyptik says:

      I haven\’t been using LimeChat recently. It\’s not surprising that it doesn\’t work in newer versions, though (they switched from ruby (was it?)) to a compiled app… so you can\’t just go in and make quick changes to the app any longer… which I\’m sure improved performance and stability… but is also a shame for this kind of reason….

Leave a Reply to georgestephanisCancel reply