-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathregex_test.f90
More file actions
30 lines (25 loc) · 868 Bytes
/
regex_test.f90
File metadata and controls
30 lines (25 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
program regex_test
use fexp
implicit none
character(len=1000) :: regex
character(len=10000) :: text
if (command_argument_count().eq.2) then
call get_command_argument(1, regex)
call get_command_argument(2, text)
if (match(trim(regex), trim(text))) then
print*, "Match: T 0s:", matchstart, "0l:", matchlength
else
print*, "Match: F"
endif
elseif (command_argument_count().eq.3) then
call get_command_argument(1, regex)
call get_command_argument(2, text)
if (match(trim(regex), trim(text), .true.)) then
print*, "DMatch: T 0s:", matchstart, "0l:", matchlength
else
print*, "DMatch: F"
endif
else
stop("regex_test error: number of arguments should be exactly 2 or 3!")
endif
end program regex_test