An open API service indexing awesome lists of open source software.

https://github.com/urbanjost/m_match

subset of Regular Expressions implemented in Fortran
https://github.com/urbanjost/m_match

bre fortran fortran-package-manager regex regular-expressions

Last synced: 5 months ago
JSON representation

subset of Regular Expressions implemented in Fortran

Awesome Lists containing this project

README

          

## ![M_match](docs/images/regex.gif)

# M_match
subset of Regular Expressions implemented in Fortran

A basic implementation in Fortran of a subset of regular expressions as
described in "Software Tools" by Kernighan and Plauger, 1976.

The original used different metacharacters than are commonly used today.

> ORIG. NOW
> ? . any single character
> * any number (including zero) of repeats of previous character
> % ^ beginning of line
> $ end of line
> @ \ escape next metacharacter
> [] a set of characters. In a set of characters
> - specifies a range of characters in a set of characters.
Must be subsets of a-z, A-Z, or 0-9
> ^ negates the set if the first character inside a set of characters.

This code functions, but a more complete (by todays' expectations)
pure-Fortran implementation is planned.

It is hoped this particular module will be useful primarily because it
is a native implementation in Fortran, albeit it is not as optimized or
as feature-rich as several common regex C libraries that, when available,
can be accessed via an ISO_C_BINDING in modern Fortran compilers.

```bash
git clone https://github.com/urbanjost/M_match.git
cd M_calculator/src
# change Makefile if not using one of the listed compilers

# for gfortran
make clean
make F90=gfortran gfortran

# for ifort
make clean
make F90=ifort ifort

# for nvfortran
make clean
make F90=nvfortran nvfortran

# run simple example program
PROGRAMS/findchange '%!'
- [github action status](docs/STATUS.md)
---

## PASSES TESTS
```text
Sat Dec 5 01:26:24 EST 2020

GNU Fortran (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
Copyright (C) 2018 Free Software Foundation, Inc.

ifort (IFORT) 19.1.3.304 20200925
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.

nvfortran 20.7-0 LLVM 64-bit target on x86-64 Linux -tp nehalem
NVIDIA Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
```