This function checks if a pattern matches a string using the regex
function and compares the result to the expected answer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pattern | |||
character(len=*), | intent(in) | :: | str | |||
character(len=*), | intent(in) | :: | answer | |||
character(len=:), | intent(inout), | allocatable | :: | substr |
function is_valid__regex(pattern, str, answer, substr) result(res) implicit none character(*), intent(in) :: pattern, str character(*), intent(in) :: answer character(:), allocatable, intent(inout) :: substr character(:), allocatable :: local integer(int32) :: length logical :: res call regex(pattern, str, local, length) substr = local res = local == answer end function is_valid__regex