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

13
LINES

< > BotCompany Repo | #1031001 // regexpReplace_directWithRefs

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

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

1  
sS regexpReplace_directWithRefs(S s, S pat, S replacement) {
2  
  Matcher m = regexp(pat, s);
3  
  ret regexpReplace_direct(m, replacement);
4  
}
5  
  
6  
sS regexpReplace_directWithRefs(Matcher m, S replacement) {
7  
  new StringBuffer buf;
8  
  while (m.find())
9  
    m.appendReplacement(buf, replaceDollarVars2_dyn(replacement,
10  
      v -> !isInteger(v) ? null : matcherGroup(m, parseInt(v))));
11  
  m.appendTail(buf);
12  
  ret str(buf);
13  
}

Author comment

Began life as a copy of #1030197

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031001
Snippet name: regexpReplace_directWithRefs
Eternal ID of this version: #1031001/4
Text MD5: 8b90dd67074f3ed8c0c6e28b570f9dcb
Transpilation MD5: c828b0c48f18a0703dc7a26db2f9934d
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:33:29
Source code size: 424 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 163 / 241
Version history: 3 change(s)
Referenced in: [show references]