Skip to content

Conversation

jhy
Copy link
Owner

@jhy jhy commented Sep 24, 2025

Added support for using the re2j regular expression engine for CSS selectors, which ensures linear-time performance for regex evaluation. This enables safe handling of arbitrary user-supplied query regexes.

To enable, add the com.google.re2j dependency to your classpath, e.g.:

<dependency>
  <groupId>com.google.re2j</groupId>
  <artifactId>re2j</artifactId>
  <version>1.8</version>
</dependency>

jhy added 2 commits September 24, 2025 16:26
Re2j is a linear-time regex engine. This enables jsoup users to now safely accept arbitrary CSS regex-based queries.
@jhy jhy marked this pull request as ready for review September 24, 2025 07:05
@jhy jhy merged commit f939ccf into master Sep 25, 2025
28 checks passed
@jhy jhy deleted the re2j branch September 25, 2025 04:43
anonyein added a commit to anonyein/jsoup that referenced this pull request Sep 25, 2025
Added option to use re2j for CSS query regexes (jhy#2407)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant