Another day, another demo.
The one thing this was missing out of the box was a way to retrieve how many total captures were created.
I added the 'slre_count()' function to my forked version to address this oversight.
This time around, the attached archive has a dll instead of a static lib.
Built with Pelles after a couple of modifications, this worked with both Pelles and MSVC on my system.
'******************************************************************************
' SLRE demo by AIR - 2024-05-04
' Github repo for SLRE: https://github.com/cesanta/slre
' My forked version, with 'slre_count()' function: https://github.com/Airr/slre
'******************************************************************************
#include "slre.h"
$typedef struct slre_cap slre_cap
$Pragma comment(lib, "slre.lib")
dim as slre_cap cap[BCXSTRSIZE]
Dim source$
source$ = "As we commemorate the 60th anniversary of BASIC, let's raise a glass to Kemeny and Kurtz."
if slre_match("(commemorate).+\s(\d+.+C).+\s(Kemeny.+Kurtz)", source$, len(source$), cap, BCXSTRSIZE, 0) then
for Integer j = 0 to slre_count() - 1
print Left$(cap[j].ptr$, cap[j].len)
next
end if
AIR.