tranqv / mod_pcreposix

Coding Fortran with Perl-Compatible Regular Expressions (in Unix)
Other
1 stars 1 forks source link
pcre regex regular-expression regular-expressions

mod_pcreposix

A portable Fortran module for the Perl compatible regular expressions (in Unix).

Notes for "pcreposix":

1) Requires. Make sure that the libs of pcre and pcreposix (i.e. libpcre.a and libpcreposix.a) were installed in our system. For instance, in Debian 8 (Jessie), we can install it quickly using the apt-get command:

and we should have

Further ref. for Debian,

https://manpages.debian.org/jessie/libpcre3-dev/index.html

https://manpages.debian.org/jessie/libpcre3-dev/pcreposix.3.en.html

and for Centos,

https://centos.pkgs.org/7/centos-x86_64/pcre-8.32-17.el7.x86_64.rpm.html

2) Provides. Files:

https://github.com/niklongstone/regular-expression-cheat-sheet

https://github.com/ZedThree/fortran_pcre

and some other cases from

https://www.regular-expressions.info/examples.html

The fortran_pcre package is excelent but this mod_pcreposix goes without the iso_c_binding module. It's just simple.

3) Compiles.

4) Tests. Run all the tests (30+ cases, or you can add more by yourself) by the command

Make sure all the Bash scripts had the executable permission, or add it using the command

5) Run all. To run all after this command


USAGE:

 1. call pcre_regcomp ( preg, pattern, istat ) 
 2. call pcre_regexec ( preg, str, pmatch, nmatch, nfound ) 
 3. call pcre_regfree ( preg ) 

where

 preg     integer(kind=8)
 pattern  character(len=*)
 istat    integer(kind=4)
 str      character(len=*)
 pmatch   integer(kind=4), dimension(2,nmatch)
 nmatch   integer(kind=4)
 nfound   integer(kind=4)

The package was well tested in Debian 9 (4.9.0-12-amd64) with gcc version 6.3.0.

Report on any bug of this code at viet204@mail.com.


UPDATE:

to revise mod_pcreposix.f90 accordingly to your local system, because the C code exe_param.c will be compiled so as it can generate values of the parameters within the region marked by

  !@@@@@BeginParam
  ...
  !@@@@@EndParam

in the Fortran file. Just do it only one time. In addition, run

  ./make.sh  clean 

to clean out.