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

16
LINES

< > BotCompany Repo | #1007002 // regexpFirstGroup - make Java regexp Matcher and return first group matched

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

Libraryless. Compilation Failed (5109L/28K).

1  
sS regexpFirstGroup(S pat, S s) {
2  
  Matcher m = regexpMatcher(pat, s);
3  
  if (m.find()) ret m.group(1); else null;
4  
}
5  
6  
sS regexpFirstGroup(java.util.regex.Pattern pat, S s) {
7  
  Matcher m = regexpMatcher(pat, s);
8  
  if (m.find()) ret m.group(1); else null;
9  
}
10  
11  
sS regexpFirstGroup(S pat, Iterable<S> strings) {
12  
  var compiled = compileRegexp(pat);
13  
  fOr (S s : strings)
14  
    try object S group = regexpFirstGroup(compiled, s);
15  
  null;
16  
}

Author comment

Began life as a copy of #1004307

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007002
Snippet name: regexpFirstGroup - make Java regexp Matcher and return first group matched
Eternal ID of this version: #1007002/6
Text MD5: 2c1c440521309f78a14ab696b9bfbf40
Transpilation MD5: a561b4124500313c842bdc6bd65fcd5e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-24 19:30:05
Source code size: 445 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 614 / 717
Version history: 5 change(s)
Referenced in: [show references]