Regex101 icon indicating copy to clipboard operation
Regex101 copied to clipboard

Java code generator

Open mibac138 opened this issue 11 years ago • 16 comments

Maybe, you would add Java generator? I would be really happy! :smiley:

mibac138 avatar Feb 16 '15 13:02 mibac138

+1

yerfinojul avatar Mar 03 '15 14:03 yerfinojul

Sure, that is not impossible, but I won't be able to support all the Java-specific syntax.

firasdib avatar Mar 22 '15 13:03 firasdib

Ok, thanks! :)

mibac138 avatar Mar 22 '15 13:03 mibac138

Java generator would be great. Thx for your work !

victor-yon avatar Mar 23 '15 16:03 victor-yon

I could generate code for Java, but it would be limited to the syntax available for the flavors regex101 supports. Since I don't support the Java flavor, you won't be able to use character class intersections etc. Are you all fine with that?

firasdib avatar Mar 23 '15 20:03 firasdib

I don't really understand where is the limitation, but it is better than nothing i guess.

victor-yon avatar Mar 23 '15 20:03 victor-yon

@Opsse: I am unable to support Java, C#, etc right now because I have found no easy way of compiling their respective regex engine into JavaScript, which is the method I have used for the other languages in order to make the website more responsive and not rely on a backend vulnerable to attacks. Does that make sense?

firasdib avatar Mar 23 '15 20:03 firasdib

Ok, i get it. For me it isn't a problem.

victor-yon avatar Mar 23 '15 20:03 victor-yon

Would be better than no java support at all.

Claudweb avatar Apr 07 '15 08:04 Claudweb

@firasdib a simple escape of \ would be enough for the most things. For completeness a simple java code for using a matcher with capturing group 1, in case you want to add that:

Pattern pattern = Pattern.compile("REGEX HERE");
Matcher matcher = pattern.matcher("STRING TO COMPARE");
if(matcher.matches()){
    String group1 = matcher.group(1);
}

Provide that with an escape of the \ literal & an disclaimer for example: "Please look into the docs for java specific syntax"

That would already be really helpful, because you have the doc-url, the escaped pattern & a basic code right in front of you.

ghost avatar Apr 19 '15 16:04 ghost

+1 for Java support even is its limited. As for sample code generation you can probably directly map a few modiers to flags in Pattern.compile()

d4nirod avatar May 14 '15 08:05 d4nirod

First, you have the best regex development page on the web - and I've tried a lot. I would love to have java code generation - it doesn't have to be compiled - just show the source.

jeffburton avatar Jul 16 '15 19:07 jeffburton

Hope it will be added in short time. Seven months is a lot for thing like this :laughing:

mibac138 avatar Sep 24 '15 18:09 mibac138

The "Code generator" itself is not really required, because its trivial. Its more because of the escaping which is required to have the regular expression in Java-Code. When you have more complex expressions its quite errorprone and annoying to escape them manually.

So it would be enough to get the expression as "escaped-Java-String".

thackel avatar Jan 04 '16 13:01 thackel

Duplicate of #54?

JensRantil avatar Feb 17 '16 10:02 JensRantil

Implemented in v2, rejoice! Lets hope I finish the site asap. (So much work)

firasdib avatar Jul 03 '16 23:07 firasdib