Provide simple regular expression subroutine: 'match' . More...
Functions/Subroutines | |
| subroutine, public | match (pattern, text, start, length) |
Provide simple regular expression subroutine: 'match'
.
| subroutine, public dc_regex::match | ( | character(len = *), intent(in) | pattern, |
| character(len = *), intent(in) | text, | ||
| integer, intent(out) | start, | ||
| integer, intent(out) | length ) |
| [in] | pattern | 例 program regex_test
implicit none
integer:: start, length
character(TOKEN) :: pattern, text
continue
pattern =
text =
call match(trim(pattern), trim(text), start, length)
call formatted_print
pattern =
text =
call match(trim(pattern), trim(text), start, length)
call formatted_print
pattern =
text =
call match(trim(pattern), trim(text), start, length)
call formatted_print
contains
subroutine formatted_print
use dc_string, only: printf
call printf(fmt='pattern= %c : text= %c : start= %d : length= %d', &
& c1=trim(pattern), c2=trim(text), i=(/start, length/))
end subroutine formatted_print
end program regex_test
pattern= -> : text= time->0.0,x->hoge : start= 5 : length= 2 pattern= ^##+ : text= ####### hoge : start= 1 : length= 7 pattern= @+$ : text= # hoge @@@ : start= 8 : length= 3 |
| [in] | text | 例 program regex_test
implicit none
integer:: start, length
character(TOKEN) :: pattern, text
continue
pattern =
text =
call match(trim(pattern), trim(text), start, length)
call formatted_print
pattern =
text =
call match(trim(pattern), trim(text), start, length)
call formatted_print
pattern =
text =
call match(trim(pattern), trim(text), start, length)
call formatted_print
contains
subroutine formatted_print
use dc_string, only: printf
call printf(fmt='pattern= %c : text= %c : start= %d : length= %d', &
& c1=trim(pattern), c2=trim(text), i=(/start, length/))
end subroutine formatted_print
end program regex_test
pattern= -> : text= time->0.0,x->hoge : start= 5 : length= 2 pattern= ^##+ : text= ####### hoge : start= 1 : length= 7 pattern= @+$ : text= # hoge @@@ : start= 8 : length= 3 |
Definition at line 266 of file dc_regex.f90.