Replace pcre-light with regex-pcre#19
Open
pbrisbin wants to merge 3 commits into
Open
Conversation
`pcre-light` requires shared library `libpcre`. This library was usually available on Ubuntu as `libpcre3`. It's now being replaced, confusingly, by `libpcre2`. Additionally, the library, and it's `-dev` varietals might not be present in Ubuntu v26, or may be present as other, also confusing names. Besides, removing a shared library requirement, absent other trade-offs seems like a good idea. And I don't know of any other trade-offs, so here we are. The keep the diff down, I defined a `match` and `compile` function with the same interfaces the `pcre-light`, but written in terms of `regex-pcre` functions. This does add an unused argument, which could be confusing, so I'm happy to messy the diff in order to address that. That `regex-pcre` functions are in `IO`, which means we require `unsafePerformIO`, but this is exactly what the `pcre-light` functions did internally anyway, so there is no change in safety introduced. I've left the error handling as `TODO` for now, but can flesh that out if/when I find this PR has a chance of being accepted. To get the OS Parser tests to pass, I had to copy the `normalize` pattern present in the UA parser. I'm not sure if it's intentional to normalize empty text to `Nothing` for UA but not OS; I hope not.
Both functions now faithfully match the `pcre-light` versions.
pbrisbin
marked this pull request as ready for review
June 2, 2026 16:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pcre-lightrequires shared librarylibpcre. This library was usuallyavailable on Ubuntu as
libpcre3. It's now being replaced, confusingly, bylibpcre2. Additionally, the library, and it's-devvarietals might not bepresent in Ubuntu v26, or may be present as other, also confusing names.
Besides, removing a shared library requirement, absent other trade-offs seems
like a good idea. And I don't know of any other trade-offs, so here we are.
The keep the diff down, I defined a
matchandcompilefunction with the sameinterfaces the
pcre-light, but written in terms ofregex-pcrefunctions.That
regex-pcrefunctions are inIO, which means we requireunsafePerformIO, but this is exactly what thepcre-lightfunctions didinternally anyway, so there is no change in safety introduced.
To get the OS Parser tests to pass, I had to copy the
normalizepatternpresent in the UA parser. I'm not sure if it's intentional to normalize empty
text to
Nothingfor UA but not OS; I hope not.