static class FRegExp extends FunctionImpl { static boolean debug; String re; *(String *re) {} public O process(Object _in) { String in = cast _in; Matcher matcher = Pattern.compile(re).matcher(in); boolean found = matcher.find(); if (debug) debug("found: " + found + ", regexp: " + re); if (found) return matcher.group(1); else return ""; } public void toJava_process(Code code) { code.line("Matcher m = Pattern.compile(" + javaQuote(re) + ").matcher(" + code.s() + ");"); code.assign("m.find() ? m.group(1) : \"\""); } }
Began life as a copy of #1000584
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date | |
---|---|---|---|---|
536 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { static class FRegExp extends FunctionImpl { static boolean debug; String re; *(String *re) {} public O process(Object _in) { String in = cast _in; Matcher matcher = Pattern.compile(re).matcher(in); boolean found = matcher.find(); if (debug) debug("found: " + found + ", regexp: " + re); if (found) return matcher.group(1); else return ""; } } }} | 2015-08-18 19:09:25 | delete |
522 | #1000604 (pitcher) | 2015-08-20 15:28:24 |
Snippet ID: | #1000622 |
Snippet name: | FRegExp |
Eternal ID of this version: | #1000622/1 |
Text MD5: | 46cffeb22c90f9edcb53766a037c7b2b |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-08-22 00:39:03 |
Source code size: | 616 bytes / 23 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1148 / 1521 |
Referenced in: | [show references] |