Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1012521 // compileRegexpIC

JavaX fragment (include)

static Map<S, java.util.regex.Pattern> compileRegexpIC_cache = syncMRUCache(10);

static java.util.regex.Pattern compileRegexpIC(S pat) {
  java.util.regex.Pattern p = compileRegexpIC_cache.get(pat);
  if (p == null) {
    ifdef compileRegexp_debug
      print("Compiling regexp (IC): " + pat);
    endifdef
    try {
      compileRegexpIC_cache.put(pat, p = java.util.regex.Pattern.compile(pat, Pattern.CASE_INSENSITIVE));
    } catch (PatternSyntaxException e) {
      throw rethrow(wrapPatternSyntaxException(e));
    }
  }
  ret p;
}

Author comment

Began life as a copy of #1007003

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1012521
Snippet name: compileRegexpIC
Eternal ID of this version: #1012521/7
Text MD5: c13878d35414e75f1fe575af0389c8a3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-20 11:30:45
Source code size: 552 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 504 / 632
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1013715 - compileRegexp
#1030996 - compileRegexpPossiblyIC
#1031004 - compileRegexpIC_unicodeCase - still breaks with certain emojis though [Java bug https://stackoverflow.com/questions/16008974/strange-java-unicode-regular-expression-stringindexoutofboundsexception]