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

22
LINES

< > BotCompany Repo | #1000718 // Quick command-line snippet search

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (117L/2K/5K).

1  
!636 (modern)
2  
3  
main {
4  
  psvm {
5  
    S s = join(" ", args);
6  
    S page = loadPage("http://tinybrain.de:8080/tb/search.php?q=" + urlencode(s));
7  
    
8  
    // example string matched: ">#1000689</a> - processSilent function (hotwire and call for processing)<br>"
9  
    //Matcher m = Pattern.compile(">#(\\d+ - .*?)</").matcher(page);
10  
    Matcher m = Pattern.compile(">(#\\d+)</a> - (.*?)<br>").matcher(page);
11  
    
12  
    print("\n== Searched for " + quote(s) + ", best results last ==\n");
13  
14  
    new L<S> results;
15  
    while (m.find()) {
16  
      results.add(m.group(1) + " - " + m.group(2));
17  
      if (results.size() > 10) break;
18  
    }
19  
    for (int i = results.size()-1; i >= 0; i--)
20  
      print(results.get(i));
21  
  }
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, hxnwyiuffukg, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1000718
Snippet name: Quick command-line snippet search
Eternal ID of this version: #1000718/1
Text MD5: e3e9813bac718d9e184bb38f958906bd
Transpilation MD5: 10fd64949b5b5110da0b82a13d82f953
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-24 18:42:41
Source code size: 723 bytes / 22 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 627 / 1089
Referenced in: [show references]