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

20
LINES

< > BotCompany Repo | #1031004 // compileRegexpIC_unicodeCase - still breaks with certain emojis though [Java bug https://stackoverflow.com/questions/16008974/strange-java-unicode-regular-expression-stringindexoutofboundsexception]

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2888L/17K).

scope compileRegexpIC_unicodeCase.

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

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

end scope

Author comment

Began life as a copy of #1012521

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031004
Snippet name: compileRegexpIC_unicodeCase - still breaks with certain emojis though [Java bug https://stackoverflow.com/questions/16008974/strange-java-unicode-regular-expression-stringindexoutofboundsexception]
Eternal ID of this version: #1031004/3
Text MD5: 4ca61d1ed785b6868df62b73eb123d25
Transpilation MD5: 418d9bb8c27d77def59b63afde6bb043
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-19 16:58:04
Source code size: 591 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 161 / 226
Version history: 2 change(s)
Referenced in: [show references]