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

12
LINES

< > BotCompany Repo | #1032800 // starToDotStarRegexp

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

Libraryless. Click here for Pure Java version (3847L/22K).

sS starToDotStarRegexp(S s) {
  int i = 0;
  new StringBuffer buf;
  while (i < l(s)) {
    int j = smartIndexOf(s, "*", i);
    buf.append(regexpQuote(substring(s, i, j)));
    if (j >= l(s)) break;
    buf.append(".*");
    i = j+3;
  }
  ret str(buf);
}

Author comment

Began life as a copy of #1024110

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032800
Snippet name: starToDotStarRegexp
Eternal ID of this version: #1032800/2
Text MD5: cd18a497f7eca27b65c59e26d70039a5
Transpilation MD5: 836e5077d4e2700fbd261e4f6bfda8e0
Author: stefan
Category: javax / regexp
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-06 07:46:42
Source code size: 267 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 66 / 100
Version history: 1 change(s)
Referenced in: [show references]