dm_regex Module

Abstraction layer over PCRE2.


Uses

  • module~~dm_regex~~UsesGraph module~dm_regex dm_regex iso_c_binding iso_c_binding module~dm_regex->iso_c_binding module~dm_error dm_error module~dm_regex->module~dm_error module~dm_kind dm_kind module~dm_regex->module~dm_kind pcre2 pcre2 module~dm_regex->pcre2 module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env

Used by

  • module~~dm_regex~~UsedByGraph module~dm_regex dm_regex module~dmpack dmpack module~dmpack->module~dm_regex

Derived Types

type, public ::  regex_type

Opaque regular expression type.


Functions

public function dm_regex_create(regex, pattern, error_message, error_offset) result(rc)

Creates new regular expression type from given pattern. Returns E_REGEX_COMPILE on error.

Arguments

Type IntentOptional Attributes Name
type(regex_type), intent(out) :: regex

Regular expression type.

character(len=*), intent(in) :: pattern

Pattern to compile.

character(len=:), intent(out), optional, allocatable :: error_message

Error message.

integer(kind=i8), intent(out), optional :: error_offset

Error offset in pattern.

Return Value integer

public function dm_regex_group(regex, subject, name, value) result(rc)

Returns group value in given subject from compiled regular expression.

Read more…

Arguments

Type IntentOptional Attributes Name
type(regex_type), intent(inout) :: regex

Regular expression type.

character(len=*), intent(in) :: subject

Input string.

character(len=*), intent(in) :: name

Group name.

character(len=:), intent(out), allocatable :: value

Group value.

Return Value integer

public function dm_regex_match(regex, subject) result(rc)

Returns E_NONE if given subject matches the compiled regular expression.

Read more…

Arguments

Type IntentOptional Attributes Name
type(regex_type), intent(inout) :: regex

Regular expression type.

character(len=*), intent(in) :: subject

Input string to match against.

Return Value integer

public function dm_regex_request(request) result(rc)

Extracts all values by group from raw response in given request type. The regular expression is compiled and destroyed by this function. The response error is set to any occuring error code.

Read more…

Arguments

Type IntentOptional Attributes Name
type(request_type), intent(inout) :: request

Request type.

Return Value integer

public function dm_regex_response_string(request, name, string, pattern) result(rc)

Returns response string from raw response, extracted by group name name. If pattern is passed, it is used as the regular expression pattern instead of the request pattern.

Read more…

Arguments

Type IntentOptional Attributes Name
type(request_type), intent(inout) :: request

Request type.

character(len=*), intent(in) :: name

Response name or regular expression group.

character(len=:), intent(out), allocatable :: string

String extracted from group name.

character(len=*), intent(in), optional :: pattern

Pattern to use instead of the request pattern.

Return Value integer


Subroutines

public subroutine dm_regex_destroy(regex)

Destroys compiled regular expression.

Arguments

Type IntentOptional Attributes Name
type(regex_type), intent(inout) :: regex

Regular expression type.