Skip to content

Commit 78ce0da

Browse files
committed
2 parents ed0f98c + c4d24f3 commit 78ce0da

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The main API is modelled around Fortran's `index` intrinsic function (which perf
1414
result = REGEX(string, pattern, length)
1515
```
1616

17+
If no substrings with the given patterns are found, or the pattern is invalid, `result = 0`. Otherwise, if the pattern was found `result > 0` equal to the leftmost location inside the string where the pattern can be found.
18+
1719
### Object-oriented interface
1820

1921
One can also parse a regex pattern into a `type(regex_op)` structure, and use that instead of a string pattern. I have no idea why this should be useful, but at least it's given with a consistent interface
@@ -38,8 +40,6 @@ program test_regex
3840
integer :: idx,ln
3941
character(*), parameter :: text = 'table football'
4042
41-
42-
4343
idx = REGEX(string=text,pattern='foo*',length=ln);
4444
4545
! Prints "foo"
@@ -50,7 +50,6 @@ end program
5050

5151

5252
```fortran
53-
5453
! Demonstrate use of object-oriented interface
5554
program test_regex
5655
use regex_module
@@ -69,14 +68,13 @@ program test_regex
6968
print *, text(idx:idx+ln-1)
7069
7170
end program
72-
7371
```
7472

7573
### To do list
7674

7775
- [ ] Add a `BACK` optional keyword to return the last instance instead of the first.
7876
- [ ] Option to return ALL instances as an array, instead of the first/last one only.
79-
- [ ] Replace fixed-size static storage with allocatable character strings (slower?)
77+
- [X] Replace fixed-size static storage with allocatable character strings (slower?)
8078

8179
### Reporting problems
8280

0 commit comments

Comments
 (0)