# New Release of Forgex - Fortran Regular Expression v3.4

**URL:** <https://fortran-lang.discourse.group/t/new-release-of-forgex-fortran-regular-expression-v3-4/8325>\
**Category:** Announcements\
**Created:** [July 10, 2024, 1:15am UTC](https://fortran-lang.discourse.group/t/new-release-of-forgex-fortran-regular-expression-v3-4/8325 "2024-07-10T01:15:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![amasaki203](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/amasaki203/32/2730_2.png) [@amasaki203](https://fortran-lang.discourse.group/u/amasaki203)\
**Post date:** [July 10, 2024, 1:15am UTC](https://fortran-lang.discourse.group/t/new-release-of-forgex-fortran-regular-expression-v3-4/8325/1 "2024-07-10T01:15:44Z")

</div>

Hi, all.

I’ve been working on regular expressions in Fortran over the last few days.

As a result, I’ve released version 2.0 of Forgex, and it is now available on GitHub.

> **[Release Forgex v2.0 · ShinobuAmasaki/forgex](https://github.com/ShinobuAmasaki/forgex/releases/tag/v2.0)**
>
> New Feature
> This release includes the following feature:
> 
> On-the-Fly DFA construciton is implemented.
> 
> About the Internal Implementation
> This includes the following internal implementation changes:...

This release includes faster matching using lazy evaluation and several fixes.

In previous versions, a deterministic finite automaton (DFA), equivalent to a non-deterministic finite automaton (NFA), was constructed in its entirety by the power set construction method before matching with a string.

Starting with this version, a dynamic lazy evaluation approach is adopted, in which the DFA is constructed simultaneously with matching, enabling a significant reduction in the time and space required for calculations.

I’m thinking about what to do next with this project, so if you have any suggestions feel free to share them!

For example:

- thread parallelization of matching,
- optimization by literal searching.

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [July 10, 2024, 3:08am UTC](https://fortran-lang.discourse.group/t/new-release-of-forgex-fortran-regular-expression-v3-4/8325/2 "2024-07-10T03:08:08Z")

</div>

> [@amasaki203](#):
>
> … I’m thinking about what to do next with this project, so if you have any suggestions feel free to share them! …

@amasaki203 , mega kudos on super effort, your code is outstanding at first glance, great service.

Re: “… what to do next with this project, so if you have any suggestions feel free to share them!,” how about making this part of Fortran **[stdlib](https://stdlib.fortran-lang.org/)**?

A possible **vision** for Fortran **stdlib** can be to have processors deploy the **stdlib** with their compiler installation packages, say `LFortran`, GCC/gfortran, Intel oneAPI toolkit, etc. to all include the standard library optimized to their compiler implementations. And having support for regex in a “standard” library for Fortran will be highly valuable for many Fortran practitioners.

---

<div class="post-metadata">

**Author:** ![amasaki203](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/amasaki203/32/2730_2.png) [@amasaki203](https://fortran-lang.discourse.group/u/amasaki203)\
**Post date:** [July 10, 2024, 5:32am UTC](https://fortran-lang.discourse.group/t/new-release-of-forgex-fortran-regular-expression-v3-4/8325/3 "2024-07-10T05:32:53Z")

</div>

> [@FortranFan](#):
>
> how about making this part of Fortran **[stdlib](https://stdlib.fortran-lang.org/)**?

Thank you for your very attractive proposal. I think it would be very useful to have a regular expression processor in stdlib.

However, I feel that there are many hurdles that this project, as well as I myself, should overcome (primarily whether my implementation fits into the workflow of the stdlib).

I cannot make a decision on this idea by myself, so I would like to take more time and also seek advice from all others.

---

<div class="post-metadata">

**Author:** ![ricriv](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@ricriv](https://fortran-lang.discourse.group/u/ricriv)\
**Post date:** [July 10, 2024, 6:23am UTC](https://fortran-lang.discourse.group/t/new-release-of-forgex-fortran-regular-expression-v3-4/8325/4 "2024-07-10T06:23:43Z")

</div>

Great job! In my opinion, the next most important feature is having a good documentation. For my codes I try to reach a 1:1 ratio between comments and lines of code, which really helps future me to understand the code after some time. You can read some instructions on how to use FORD [in this post](https://fortran-lang.discourse.group/t/how-to-use-ford-for-your-documentation/8272/2). Afterwards you could focus on implementing the CI. I know that these aren’t the most fun activities, but having a well documented code helps to attract contributors, and a good CI prevents countless bugs from happening.

---

<div class="post-metadata">

**Author:** ![amasaki203](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/amasaki203/32/2730_2.png) [@amasaki203](https://fortran-lang.discourse.group/u/amasaki203)\
**Post date:** [July 10, 2024, 7:49am UTC](https://fortran-lang.discourse.group/t/new-release-of-forgex-fortran-regular-expression-v3-4/8325/5 "2024-07-10T07:49:55Z")

</div>

> [@ricriv](#):
>
> In my opinion, the next most important feature is having a good documentation.

This is an important point for me. I had forgotten to improve the documentation for developers, so thank you for reminding me. I agree that this topic is essential, so I will make it a high priority.

On the other hand, I have little experience with CI, so I will read the post you shared and learn more from it and others.

---

<div class="post-metadata">

**Author:** ![amasaki203](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/amasaki203/32/2730_2.png) [@amasaki203](https://fortran-lang.discourse.group/u/amasaki203)\
**Post date:** [August 25, 2024, 4:50am UTC](https://fortran-lang.discourse.group/t/new-release-of-forgex-fortran-regular-expression-v3-4/8325/6 "2024-08-25T04:50:14Z")

</div>

Forgex version 3.4 was just released! [It’s available in the github repository.](https://github.com/ShinobuAmasaki/forgex)

The main changes compared to version 2 include:

- FORD documentation (work in progress): [Forgex—Fortran Regular Expression](https://shinobuamasaki.github.io/forgex)
- `.in.` and `.match.` operators with `pure elemental` attributes.
- `regex` subroutine and `regex_f` function with `pure` attribute.
- Literal search optimization for matching.
- Faster implementation of AST, NFA and DFA through the use of arrays.
- A command line tool `forgex-cli` for testing and benchmarking.
- Fixed issue where carets and dollars inside parentheses did not match.

I posted an article about the release of version 3 onwards:

> **[Forgex v3.4 Released](https://shinobuamasaki.github.io/items/literal-optimized-forgex.html)**
>
> Fortran Regular Expression
> version 3.4 have been released.
