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).

1  
scope compileRegexpIC_unicodeCase.
2  
3  
static Map<S, java.util.regex.Pattern> #cache = syncMRUCache(10);
4  
5  
static java.util.regex.Pattern compileRegexpIC_unicodeCase(S pat) {
6  
  java.util.regex.Pattern p = cache.get(pat);
7  
  if (p == null) {
8  
    ifdef compileRegexp_debug
9  
      print("Compiling regexp (IC): " + pat);
10  
    endifdef
11  
    try {
12  
      cache.put(pat, p = java.util.regex.Pattern.compile(pat, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE));
13  
    } catch (PatternSyntaxException e) {
14  
      throw rethrow(wrapPatternSyntaxException(e));
15  
    }
16  
  }
17  
  ret p;
18  
}
19  
20  
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: 95 / 151
Version history: 2 change(s)
Referenced in: [show references]