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

15
LINES

< > BotCompany Repo | #1023987 // andCombineRegexps

JavaX fragment (include)

sS andCombineRegexps(LS regexps) {
  if (l(regexps) == 1) ret first(regexps);
  if (empty(regexps)) ret "";
  StringBuilder out = new("^");
  for i over regexps:
    if (i < l(regexps)-1)
      out.append("(?=.*?" + regexps.get(i) + ")");
    else
      out.append(".*?" + regexps.get(i));
  ret str(out);
}

sS andCombineRegexps(S... regexps) {
  ret andCombineRegexps(asList(regexps));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1023987
Snippet name: andCombineRegexps
Eternal ID of this version: #1023987/3
Text MD5: de898c1ec6948fd305ebda9c7d4656e5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-14 21:19:46
Source code size: 403 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 198 / 233
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1026201 - orCombineRegexps