Issue 1401: commentlink feature doesn't ignore case when matching commit mesage and comments
Status:  WontFix
Owner: ----
Closed:  May 2012
Reported by Yubao....@gmail.com, May 22, 2012
I have this setting in my gerrit.config:

[commentlink "bugzilla"]
        link = http://bugzilla.corp.example.com/show_bug.cgi?id=$2
        match = "(BUG|Bug|bug|BUGZILLA|Bugzilla|bugzilla|BZ|Bz|bz|TICKET|Ticket|ticket|ISSUE|Issue|issue)\\s*:?\\s*#?(\\d+)"

It would be helpful that commentlink feature doesn't care case by default.
May 22, 2012
Project Member #1 bklarson@gmail.com
Lots of users do want case sensitive matches, so we will not change this.  However, I believe you can make your search case insensitive by adding (?i) to the start of the regex.  See http://stackoverflow.com/questions/43632/can-you-make-just-part-of-a-regex-case-insensitive
Status: WontFix
May 23, 2012
#2 Yubao....@gmail.com
Thanks for your link, but the link says that doesn' work in JavaScript...

$ less logs/error_log

[2012-05-23 16:50:33,371] ERROR com.google.gerrit.httpd.rpc.SystemInfoServiceImpl : Client UI JavaScript error: User-Agent=Mozilla/5.0 (X11; Linux x86_64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1 Iceweasel/9.0.1: Invalid commentlink pattern(s):
  "(?i)(bug|BUGZILLA|Bugzilla|bugzilla|BZ|Bz|bz|TICKET|Ticket|ticket|ISSUE|Issue|issue)\s*:?\s*#?(\d+)": (SyntaxError): invalid quantifier
   fileName: http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html
   stack: SRc("test trackingid\n\nChange-Id: I4828553b15716e1a9d26af264106e4c0fe7509cd\nTicket: 33\n","(?i)(bug|BUGZILLA|Bugzilla|bugzilla|BZ|Bz|bz|TICKET|Ticket|ticket|ISSUE|Issue|issue)\\s*:?\\s*#?(\\d+)","<a href=\"http://bugzilla.corp.example.com/show_bug.cgi?id=$2\">$&</a>")@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:2018
  uMc([object Object],[object Object])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:2584
  e5([object Object])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:3090
  XP([object Object],"test trackingid\n\nChange-Id: I4828553b15716e1a9d26af264106e4c0fe7509cd\nTicket: 33\n")@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:2896
  I_([object Object],[object Object],true)@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:358
  C0([object Object])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:364
  Il([object Object])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:3146
  zNc([object Object],[object Object],[object Object])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:2610
  CPc([object Object],[object Object])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:3161
  TXb([object Object],[object Object])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:2717
  tYb([object XMLHttpRequest])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:3155
  ([object Event])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:2135
  qNb((function () {b.ze(c);}),[object XMLHttpRequest],[object Arguments])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:1735
  tNb((function () {b.ze(c);}),[object XMLHttpRequest],[object Arguments])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:2337
  ([object Event])@http://gerrit.corp.example.com/gerrit/F603A082B141A26D031D8A8E3846A902.cache.html:2279
  
   lineNumber: 2018


It would be great if there is an option like commentlink.xxx.ignoreCase = true
or commentlink.xxx.regexpOptions = i.

JavaScript supports literal regexp like "var pat = /bug/i", I tried to
set commentlink.bugzilla.match = "/bug/i", but it doesn't work and match nothing.

May 23, 2012
Project Member #3 bklarson@gmail.com
Hrm, I thought (?i) would work, because it works in java and we are calling java's String.replaceAll() method (although translated into javascript...).  I'm surprised neither (?i) or /i work.  :/

I guess the only option is to follow the docs at https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#_a_id_commentlink_a_section_commentlink and use a pattern like [bB][uU][gG]
May 23, 2012
#4 Yubao....@gmail.com
I took a look at the related gwtexpui code, seems not a minor change by two or three lines, I feel it's not worth enhancing the code to satisfy my requirement, I'll take
your workaround, anyway, there are only a few words and I can generate the ugly pattern
by a one-line script :-D

Thanks!