Fortran `regex` library

People wanting to test it can just create a fpm project: fpm new my_regex

then put that code into the app/main.f90:

program main
   use regex_module

   implicit none
   integer :: idx,ln
   character(*), parameter :: text = 'Avida Dollar$'

   idx = REGEX(string=text, pattern='[A-Z][a-z]+\$', length=ln)

   print '(I0, "|", A ,"|")', idx, text(idx:idx+ln-1)
end program main

and add those lines in the fpm.toml manifest:

[dependencies]
fortran-regex = { git = "https://github.com/perazz/fortran-regex", branch = "main" }

then just type: fpm run

and you are on the way for unknown pleasures with 100% Fortran regex!

You can test your regex with online tools like https://pythex.org/
(Frederico put the supported patterns at the beginning of https://github.com/perazz/fortran-regex/blob/main/src/regex.f90)

3 Likes