Skip to content

Commit

Permalink
(feat) regex: pcre2.regex.jit flag
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-pelykh committed Jun 26, 2024
1 parent 815a2d3 commit 0b4d767
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public class Usage {
}
```

By default, the JIT compilation is used in cases the platform and the library support it. To override this behavior, you
can set the `pcre2.regex.jit` system property with the value `false` to the JVM.

### Advanced Usage via PCRE4J API

Add the following dependencies to your `pom.xml` file:
Expand Down
3 changes: 2 additions & 1 deletion regex/src/main/java/org/pcre4j/regex/Pattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ private Pattern(IPcre2 api, String regex, int flags) {
}

try {
if (Pcre4jUtils.isJitSupported(api)) {
final var isJitAllowed = Boolean.parseBoolean(System.getProperty("pcre2.regex.jit", "true"));
if (Pcre4jUtils.isJitSupported(api) && isJitAllowed) {
this.code = new Pcre2JitCode(
api,
regex,
Expand Down

0 comments on commit 0b4d767

Please sign in to comment.