Provides simple regular expression subroutine: 'match'. More...
Functions/Subroutines | |
| subroutine, public | match (pattern, text, start, length) |
Provides simple regular expression subroutine: 'match'.
This module provides a simple regular expression matching function.
| Pattern | Description |
|---|---|
| . | Any single character |
| ? | Zero or one of previous |
| + | One or more of previous |
| * | Zero or more of previous |
| ^ | Beginning of string |
| $ | End of string |
| [abc] | Character class |
| [^abc] | Negated character class |
| #d | Digit (0-9) |
| #a | Alphabetic character |
| #w | Word character (alphanumeric + _) |
| #s | Whitespace |
| #z | Hexadecimal digit |
| #xHH | Hexadecimal character code |
| subroutine, public dc_regex::match | ( | character(len = *), intent(in) | pattern, |
| character(len = *), intent(in) | text, | ||
| integer, intent(out) | start, | ||
| integer, intent(out) | length ) |
Match regular expression pattern against text
Matches the given regular expression pattern against the text string.
If pattern matches text, start returns the position (1-based) where the match begins, and length returns the number of matched characters.
If no match is found, length == -1 and start == 0.
| [in] | pattern | Regular expression pattern |
| [in] | text | Text string to search |
| [out] | start | Starting position of match (0 if no match) |
| [out] | length | Length of match (-1 if no match) |
Definition at line 468 of file dc_regex.f90.