Hello,
The wiki doesn't have a top-level page on using regular expressions, but there are a couple of threads in the forum archives.
Am I correct in understanding that 1) Freebasic has include files for two regex engines (\examples\regex\: PCRE and TRE), and 2) the source of the libraries must be downloaded and compiled by the user?
If true, is there a tutorial on how to set up a compiler on Windows, and compile sources?
Thank you.
Regular expression module(s)?
-
- Posts: 62
- Joined: May 21, 2010 11:47
Re: Regular expression module(s)?
I compiled PCRE about a year ago, feel free to use that:
https://users.freebasic-portal.de/stw/f ... re-080.zip
Both PCRE and TRE are written in C.
To compile it yourself you need a build environment (suggest MSYS2: https://www.msys2.org/ ) and a suitable toolchain (ideally use the same that was used for building FreeBasic, see the Releases page: https://freebasic.net/forum/viewtopic.p ... 47#p288547 ). Also build tools like make, CMake, etc. might be required. Most often you run either a "configure" script (GNU autotools) or CMake configure first, then "make" afterwards.
I usually included the configurable files used during the build in the archives above.
When I do it next time I might write down a step by step guide. For now (without actually trying it out) I can only give general instructions.
libtre doesn't seem to get updated anymore, my libtre 0.8.0 build from 2016 still seems to be the latest available version:St_W wrote: ↑Jan 03, 2021 0:46 compiled and uploaded the latest version (of the v1 branch), which is currently 8.44
https://users.freebasic-portal.de/stw/f ... static.zip
tried to use the same config as the older version; untested; built with gcc 7.3.0 / msys2
if you were looking for pcre2 instead, which is currently at version 10.36, i compiled & uploaded that as well (same config/compiler):
https://users.freebasic-portal.de/stw/f ... static.zip
https://users.freebasic-portal.de/stw/f ... re-080.zip
Both PCRE and TRE are written in C.
To compile it yourself you need a build environment (suggest MSYS2: https://www.msys2.org/ ) and a suitable toolchain (ideally use the same that was used for building FreeBasic, see the Releases page: https://freebasic.net/forum/viewtopic.p ... 47#p288547 ). Also build tools like make, CMake, etc. might be required. Most often you run either a "configure" script (GNU autotools) or CMake configure first, then "make" afterwards.
I usually included the configurable files used during the build in the archives above.
When I do it next time I might write down a step by step guide. For now (without actually trying it out) I can only give general instructions.
-
- Posts: 62
- Joined: May 21, 2010 11:47
Re: Regular expression module(s)?
Thanks. Looks like all it takes is copying the .dll and .a files into Freebasic's \lib\win32\, and including either regex.bi (PCRE, PCRE2) or tre.bi (TRE).
Which regex engine do you recommend?
--
Edit
"The program can't start because tre.dll is missing from your computer. Try reinstalling the program to fix this problem."
--
Edit
fbc -p c:\Apps\FreeBASIC-1.09.0\lib\win32 c:\match.bas
=> DLL not found
fbc -static c:\match.bas
=>
c:\Apps\FreeBASIC-1.09.0\bin\win32\ld.exe: cannot find -lmsvcrt
c:\Apps\FreeBASIC-1.09.0\bin\win32\ld.exe: cannot find -lkernel32
c:\Apps\FreeBASIC-1.09.0\bin\win32\ld.exe: cannot find -luser32
--
Edit:
It runs if I copy those files where the compiled file lives, but there must be a way to tell FB to look for them in its own directories.
Which regex engine do you recommend?
--
Edit
"The program can't start because tre.dll is missing from your computer. Try reinstalling the program to fix this problem."
--
Edit
fbc -p c:\Apps\FreeBASIC-1.09.0\lib\win32 c:\match.bas
=> DLL not found
fbc -static c:\match.bas
=>
c:\Apps\FreeBASIC-1.09.0\bin\win32\ld.exe: cannot find -lmsvcrt
c:\Apps\FreeBASIC-1.09.0\bin\win32\ld.exe: cannot find -lkernel32
c:\Apps\FreeBASIC-1.09.0\bin\win32\ld.exe: cannot find -luser32
--
Edit:
It runs if I copy those files where the compiled file lives, but there must be a way to tell FB to look for them in its own directories.
- libtre.a
- libtre.dll.a
- tre.dll