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

15
LINES

< > BotCompany Repo | #1023987 // andCombineRegexps

JavaX fragment (include)

1  
sS andCombineRegexps(LS regexps) {
2  
  if (l(regexps) == 1) ret first(regexps);
3  
  if (empty(regexps)) ret "";
4  
  StringBuilder out = new("^");
5  
  for i over regexps:
6  
    if (i < l(regexps)-1)
7  
      out.append("(?=.*?" + regexps.get(i) + ")");
8  
    else
9  
      out.append(".*?" + regexps.get(i));
10  
  ret str(out);
11  
}
12  
13  
sS andCombineRegexps(S... regexps) {
14  
  ret andCombineRegexps(asList(regexps));
15  
}

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: 197 / 233
Version history: 2 change(s)
Referenced in: [show references]