-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java flavor #54
Comments
Still no success :(... I could host it on a server, but that would defeat the purpose. |
I just want to leave +1 for that feaure request as your online tool is the coolest tool for regular expressions I ever seen. I'd love to see the ability to construct regexps for java in it. |
+1 I do a lot of regexing in Java and this would be nice to have. Also, Ruby and .NET if possible :3 Donated hopefully <3 |
+1 for idea. The differences between Java and PCRE is that several constructs are absent ( As mentioned by the official documentation:
Also, idea for code generation:
|
@Vincentyification I could create a syntax parser for Java and use the PCRE engine underneath. It's probably not going to work identically to Java, but pretty damn close and it will check the syntax for people. |
@firasdib That's a great idea, and possibly close to where I was originally going. Since the Java Pattern syntax doesn't change frequently (In fact, since it was established on Java 5 it never changed), any maintainable implementation would work for this case. I thought of this while searching for a Java library which could parse PCRE, but got sidetracked seeing http://regex101.com having an exclusive bullet point documented by Wikipedia under "Links" section. I thought since Java syntax is based on Perl, a short regex could be used to check for invalid syntaxes that wouldn't apply in Java, and converting Java-style character classes to Perl. |
+1 |
+1. I missed out on this post and created a new one. Please disregard that. Thanks. |
@Vincentyification: There are lots of f*ck up things in the reference implementation (Oracle and OpenJDK) of Java regex that wouldn't present in PCRE. For example: negation of negation of character class, definition of |
@nhahtdh +1 Great points! |
+1 for explicit Java support |
Support for intersections in Java would be great: http://www.regular-expressions.info/charclassintersect.html (Just made a small donation re this feature) |
+1 please add this |
👍 |
The new release will feature a code generator for Java which might help some, alteast with those pesky backslashes. The PCRE engine is still as close as you're going to get, which is likely going to cover it for most of your cases. But so far I have not been able to get the actual engine running. Sorry! |
me too |
Hi everybody! I just managed to compile the Java regex engine to javascript by taking the engine from the openjdk ( It's currently based on java 8, does anybody know if there is any relevant changes made to the engine since then? |
@simonlindberg As far as I know, yes there were some changes made to the regexp engine after Java 8 : |
@OlivierJaquemet Looked at a few and most of them seems to be performance related or regressions i later version. I did find one that might be related, https://bugs.openjdk.java.net/browse/JDK-6609854 , might be more like it. |
Thanks to the work by @simonlindberg, you can expect regex101 to support java shortly! Keep a close eye on the website the coming days... |
Can this be updated for post java 9? Should I create a new issue? I'm having issues debugging why my regex is matching everything except for the final match which regex101 says it should be matching. My regex: Regex101 states that the string But in java it only matches twice (video below): |
Apparently I'm either misusing https://www.tutorialspoint.com/javaregex/javaregex_matcher_hitend.htm import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TestMain {
static final String test = "d4d4d4";
static final Pattern regex = Pattern.compile("(?<amount>[\\+\\-]?\\d*)(?<die>d\\d+){0,1}(?<type>(?>(?!d\\d+)[\\w\\s])*)");
static final Pattern regex2 = Pattern.compile("d4");
public static void main(String[] args) {
Matcher matcher = regex.matcher(test);
do {
matcher.find();
System.out.println(matcher.group("die") + " hitEnd: " + matcher.hitEnd());
}
while(!matcher.hitEnd());
System.out.println("==============");
matcher = regex2.matcher(test);
do {
matcher.find();
System.out.println(matcher.group() + " hitEnd: " + matcher.hitEnd());
}
while(!matcher.hitEnd());
}
} Which gives the output:
In the first example, hitEnd() returns prematurely, and in the second example, it never returns true. Either way, I now know this isn't a Regex101 problem. Do you think this is a JDK issue, or am I just using hitEnd() incorrectly (or both)? |
Any change of support for java?
Thanks for the great job.
The text was updated successfully, but these errors were encountered: