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
2 comment(s) hidden. show
| 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: | 1550 / 1944 |
| Referenced in: | [show references] |