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).

sS regexpFirstGroup(S pat, S s) {
  Matcher m = regexpMatcher(pat, s);
  if (m.find()) ret m.group(1); else null;
}

sS regexpFirstGroup(java.util.regex.Pattern pat, S s) {
  Matcher m = regexpMatcher(pat, s);
  if (m.find()) ret m.group(1); else null;
}

sS regexpFirstGroup(S pat, Iterable<S> strings) {
  var compiled = compileRegexp(pat);
  fOr (S s : strings)
    try object S group = regexpFirstGroup(compiled, s);
  null;
}

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: 527 / 610
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1007004 - regexpFirstGroupIC - make Java regexp Matcher and return first group matched (ignore case)
#1009088 - regexpFirstGroup_lastMatch - make Java regexp Matcher and return first group matched in last match
#1013199 - regexpFirstGroups - make Java regexp Matcher and return all groups of first match
#1013727 - regexpFirstGroupOneOf - make Java regexp Matcher and return first group matched
#1017010 - regexpFirstMatch - make Java regexp Matcher and return first match
#1025117 - regexpFirstGroup_any - make Java regexp Matcher and return first group matched