-
Notifications
You must be signed in to change notification settings - Fork 17
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
Show off DFA's strength #5
base: master
Are you sure you want to change the base?
Conversation
Clean code / Use checkstyle
RegExp Comparison
DFA are good at matching missing, optional patterns. See https://swtch.com/~rsc/regexp/regexp1.html
src/test/java/RegexTest.java
Outdated
for (int i = 0; i < count; i++) { | ||
result.append(str); | ||
} | ||
return result.toString; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be return result.toString()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zhztheplayer You're correct. I tested only the Java 11 version and wrote a fix for versions < 11 by hand without testing. That fix included a typo which you correctly noted. I fixed that typo.
d0f9392
to
a1b8992
Compare
Usual implementations don't match failing branches very well while DFAs do that very well. Let's show that! See https://swtch.com/~rsc/regexp/regexp1.html