Files
java-core-examples/regex/output/07-jdk-source.txt
T

23 lines
986 B
Plaintext

$ java -version
openjdk version "25.0.4.1" 2026-08-18 LTS
OpenJDK Runtime Environment Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS)
OpenJDK 64-Bit Server VM Temurin-25.0.4.1+1 (build 25.0.4.1+1-LTS, mixed mode, sharing)
$ unzip -p lib/src.zip java.base/java/util/regex/Pattern.java | sed -n "/Optimize the greedy Loop/,/^ }$/p"
// Optimize the greedy Loop to prevent exponential backtracking, IF there
// is no group ref in this pattern. With a non-negative localTCNCount value,
// the greedy type Loop, Curly will skip the backtracking for any starting
// position "i" that failed in the past.
if (!hasGroupRef) {
for (Node node : topClosureNodes) {
if (node instanceof Loop) {
// non-deterministic-greedy-group
((Loop)node).posIndex = localTCNCount++;
}
}
}
$ grep -ci timeout Pattern.java Matcher.java
Pattern.java: 0
Matcher.java: 0