[ library(regex) | Reference Manual | Alphabetic Index ]

match(+Pattern, +String, +Options, -Match)

Match is the first substring of String that matches the regular expression Pattern
Pattern
A string (or a compiled pattern handle)
String
A string
Options
List of atoms
Match
Output: a string

Description

Succeeds if all or a substring of String matches the regular expression Pattern. For the description of regular expressions see the library(regex) page.

Options is a (possibly empty) list of atomic option names, as described in the library(regex) page.

Match is bound to the first substring of String which matches Pattern.

Note that this predicate does not return any information about matching (parenthesised) sub-expressions!

Modes and Determinism

Fail Conditions

String does not match Pattern

Examples

    ?- match("<[a-z]+>", "Text with <HTML> tags", [icase], M).
    M = "<HTML>"
    Yes
    

See Also

library(regex), match / 2, match / 3, matchsub / 4, matchall / 4, compile_pattern / 3