11# fortran-pcre2
2+
23A work-in-progress collection of Fortran 2018 ISO_C_BINDING interfaces to
34Perl-compatible Regular Expressions 2
45([ PCRE2] ( https://www.pcre.org/current/doc/html/ ) ). The library is also available
56on [ MacPorts] ( https://ports.macports.org/port/fortran-pcre2/ ) .
67
78## Build Instructions
9+
810You will need * libpcre2* with development headers. On FreeBSD, run:
911
1012```
@@ -26,16 +28,23 @@ $ cd fortran-pcre2/
2628$ make
2729```
2830
31+ Install the library and the modules files system-wide to ` /opt ` :
32+
33+ ```
34+ $ make install PREFIX=/opt
35+ ```
36+
2937Instead of ` make ` , you may want to build the library using the Fortran Package
3038Manager:
3139
3240```
33- $ fpm build --profile= release
41+ $ fpm build --profile release
3442```
3543
3644Link your Fortran programs against ` libfortran-pcre2.a ` and ` -lpcre2-8 ` .
3745
3846## Example
47+
3948The following program just compiles and executes a basic regular expression.
4049
4150``` fortran
@@ -99,15 +108,17 @@ program main
99108end program main
100109```
101110
102- Compile, link, and run the program with, for example:
111+ If the library is installed to ` /opt ` , then compile, link, and run the program
112+ with:
103113
104114```
105- $ gfortran -o example example.f90 libfortran-pcre2.a -lpcre2-8
115+ $ gfortran -I/opt/include/libfortran-pcre2 - o example example.f90 /opt/lib/ libfortran-pcre2.a -lpcre2-8
106116$ ./example
107117```
108118
109- ## fpm
110- You can add * fortran-pcre2* as an [ fpm] ( https://github.com/fortran-lang/fpm )
119+ ## Fortran Package Manager
120+
121+ You can add * fortran-pcre2* as an [ FPM] ( https://github.com/fortran-lang/fpm )
111122dependency:
112123
113124``` toml
@@ -116,6 +127,7 @@ fortran-pcre2 = { git = "https://github.com/interkosmos/fortran-pcre2.git" }
116127```
117128
118129## Compatibility
130+
119131It is not necessary to null-terminate character strings given to the procedures
120132of * fortran-pcre2* . In contrast to the C API of PCRE2, you must not free
121133substrings with ` pcre2_substring_free() ` , as this will be done by the wrapper
@@ -142,4 +154,5 @@ functions.
142154| ` pcre2_substring_number_from_name_8 ` | ` pcre2_substring_number_from_name ` |
143155
144156## Licence
157+
145158ISC
0 commit comments