Libraryless. Click here for Pure Java version (3522L/21K).
static LS jextractAll_any(S s, S... patterns) { ret jextractAll_any(javaTok(s), patterns); } static LS jextractAll_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(jfindAll(tok, tokPat), i -> pair(i, i+l(tokPat)-2))); } ret mapPairsToList(set, (start, end) -> joinSubList(tok, start, end)); }
Began life as a copy of #1027860
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1031634 |
| Snippet name: | jextractAll_any - find multiple patterns |
| Eternal ID of this version: | #1031634/1 |
| Text MD5: | e8d4f6cb584f09d25a8e4255eaa67ed5 |
| Transpilation MD5: | 0e1fa64967f8ee79aba5064af4f3fa28 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-06-24 18:04:48 |
| Source code size: | 459 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 356 / 462 |
| Referenced in: | [show references] |