Why PCRE instead of PCRE2?

Discuss the future of the AutoHotkey language
SAbboushi
Posts: 50
Joined: 08 Dec 2014, 22:13

Why PCRE instead of PCRE2?

12 Jun 2018, 14:31

From the documentation, I understand that AHK has implemented PCRE. Curious why AHKv2 is not using PCRE2 since I've found several AHK posts about desired features like regex global matching and some of the attempts at workarounds e.g. RegexMatchAll() and a grep solution.

Looking at PCRE's site, is seems PCRE2 has features like regex global matching?

Finding all matches in a string
Searching for all possible matches within a subject can be requested by the global or altglobal modifier. After finding a match, the matching function is called again to search the remainder of the subject. The difference between global and altglobal is that the former uses the start_offset argument to pcre2_match() or pcre2_dfa_match() to start searching at a new point within the entire string (which is what Perl does)...


Just wondering
lexikos
Posts: 5933
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Why PCRE instead of PCRE2?

12 Jun 2018, 19:09

Let me answer that with a question: Why PCRE2 instead of PCRE?

We don't need PCRE2 to perform global matching; we can just call the matching function in a loop, just like PCRE2 does according to your quote. RegExReplace already does this. The reason we don't have a global matching function built-in is that none of the developers cared to add it. It is easy enough to use RegExMatch in a loop - these are not "attempts at workarounds", but perfectly valid solutions to a problem.

Rather than "Why PCRE instead of PCRE2?", the question is really "Why hasn't the version of PCRE used by AutoHotkey been updated?". The answer is, again, that none of the developers cared to do it.

By "developers", I mean anyone with the will to make a contribution of that nature. Personally, I never even considered updating to PCRE2, because I'm not aware of any reason to do so and have no interesting in finding one.

The reason PCRE2 is not just "PCRE version 10" is that its API is not compatible. It isn't just a case of dropping in the PCRE library and making use of the new features; any code dealing with PCRE has to be updated.
SAbboushi
Posts: 50
Joined: 08 Dec 2014, 22:13

Re: Why PCRE instead of PCRE2?

13 Jun 2018, 00:24

Thanks for your response - and for the education. And many thanks for all your work regarding the amazing autohotkey.

I tend to use RegexBuddy to develop & test my regexes. Is "PCRE 8.40-8.42 UTF-8" the correct selection for compatibility with AHK?
swagfag
Posts: 709
Joined: 11 Jan 2017, 17:59

Re: Why PCRE instead of PCRE2?

13 Jun 2018, 03:22

8.30 is what ahk uses, last time I checked.
User avatar
jeeswg
Posts: 4481
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Why PCRE instead of PCRE2?

13 Jun 2018, 03:24

- From the AHK changelog:
Changes & New Features
https://autohotkey.com/docs/AHKL_ChangeLog.htm
1.1.08.00 - July 14, 2012
...
Upgraded PCRE to 8.30.
- From the AHK source code, in pcre.h:

Code: [Select all] [Download] GeSHi © Codebox Plus

/* The current PCRE version information. */

#define PCRE_MAJOR 8
#define PCRE_MINOR 30
#define PCRE_PRERELEASE
#define PCRE_DATE 2012-02-04
SAbboushi
Posts: 50
Joined: 08 Dec 2014, 22:13

Re: Why PCRE instead of PCRE2?

13 Jun 2018, 04:39

Thanks folks

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: swagfag and 0 guests