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

13
LINES

< > BotCompany Repo | #1027860 // jextractAllIC_any - find multiple patterns

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

Libraryless. Click here for Pure Java version (3124L/20K).

static LS jextractAllIC_any(S s, S... patterns) {
  ret jextractAllIC_any(javaTok(s), patterns);
}

static LS jextractAllIC_any(LS tok, S... patterns) {
  new TreeSet<Pair<Int>> set; // pair(startIndex, endIndex)
  for (S pat : patterns) {
    LS tokPat = javaTok(pat);
    jfind_preprocess(tokPat);
    set.addAll(map(jfindAllIC(tok, tokPat), i -> pair(i, i+l(tokPat)-2)));
  }
  ret mapPairsToList(set, (start, end) -> joinSubList(tok, start, end));
}

Author comment

Began life as a copy of #1027859

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027860
Snippet name: jextractAllIC_any - find multiple patterns
Eternal ID of this version: #1027860/4
Text MD5: 5a91ae087a0d6e69a23ce23e848f687d
Transpilation MD5: 8fca3a5fbbc277aa79876b5f8f6f6752
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-16 11:55:43
Source code size: 467 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 236
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1027861 - jextractAllIC_any_returnCNC - find multiple patterns, return sub-tokenizations
#1031634 - jextractAll_any - find multiple patterns
#1032854 - jfindAll_reversed_any - find multiple patterns