Libraryless. Click here for Pure Java version (2728L/17K).
sS regexpReplaceWithFirstGroup(Pattern pat, S s) { ret regexpReplaceWithFirstGroup(regexp(pat, s)); } // TODO: why IC? sS regexpReplaceWithFirstGroup(S pat, S s) { ret regexpReplaceWithFirstGroup(regexpIC(pat, s)); } sS regexpReplaceWithFirstGroup(Matcher m) { new StringBuffer buf; while (m.find()) m.appendReplacement(buf, m.group(1)); m.appendTail(buf); ret str(buf); }
Began life as a copy of #1018263
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
| Snippet ID: | #1021192 |
| Snippet name: | regexpReplaceWithFirstGroup - replace occurrence with first group of pattern |
| Eternal ID of this version: | #1021192/4 |
| Text MD5: | 143e33fe15802d28afe901be41625a8f |
| Transpilation MD5: | 461ea1c52e02ba70fb064643f89d59ab |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-06-07 17:58:28 |
| Source code size: | 405 bytes / 16 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 590 / 741 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |