Poll: Experiences with the migration to PCRE2

A couple of weeks ago we announced the upgrade of Crystal’s regex engine to PCRE2. The upgraded engine is used by default in nightly releases and can be optionally tested in Crystal 1.7 with the -Duse_pcre2 flag (we recommend 1.7.3 for that).

We have since received some feedback from the community. Besides positive and mostly (i.e. only requiring minor adjustments) reports, we’ve seen a guide about diligent compatibility testing and some critical comments on the transition process. I am not aware of any reports about major issues with the upgrade. That’s a good sign, but we should get more meaningful insights.

So I’m asking you to respond to this poll to help gauge the effect of the PCRE2 transition in the Crystal ecosystem.

The poll is open for everybody, no matter if you’re an Open Source shard author, hacking a personal project, working on a professional product or just building somebody else’s code.
Please select all that apply, especially when working with multiple Crystal projects.

Experiences with PCRE2
  • Everything works fine with PCRE2
  • PCRE2 broke some code and I’m opting out for now
  • PCRE2 broke some code and I have updated my project to support it
  • I have not tried PCRE2 yet
  • I do not use regular expressions in my projects

0 voters

Please leave a comment with some details if anything may need clarification. For example what kind of failures you have seen or why you’re planning to stay away from PCRE2.

Thanks for your participation :bowing_man:

So I guess I’ll be the first: :laughing:
I observed a minor issue with the regex syntax in one particular instance (straight-shoota/crinja#59): In PCRE2 a hyphen inside a character class must be escaped if it does not denote a character range. PCRE accepted it as a literal hyphen. I appreciate the new strictness, so doing this change was a good thing anyway.

1 Like

For exercism, did I just test run our current tooling which is used, with a nightly build of crystal.
All tests pass, so that looks good.

I decided to test some of our student’s solutions regex against 1.8 as well, and all solutions that I was able to find that used regex seems to pass. There will likely be some student solutions I didn’t find which didn’t pass.

But the exercism tooling will move to 1.8 with pcre2 in any case.


No tests fail for ktistec, so for now I voted “Everything works fine…”. I’m planning on reviewing the regular expressions in my code to ensure I do have adequate test coverage, and I’ll start running pcre2 during development locally. Hopefully those two things flush out any problems that do come up.

1 Like