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

match(+Pattern, +String, +Options)

A substring of String matches the regular expression Pattern
Pattern
A string (or a compiled pattern handle)
String
A string
Options
List of atoms

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.

Modes and Determinism

Fail Conditions

String does not match Pattern

Examples

    ?- match("april", "April", []).
    No
    ?- match("april", "April", [icase]).
    Yes

    ?- match("(^(a[cd]a)$)+", "aca\nada", []).
    No
    ?- match("(^(a[cd]a)$)+", "aca\nada", [newline]).
    Yes

    ?- match("\\<word\\>", "a word only", [basic]).
    Yes
    ?- match("\\<word\\>", "not words though", [basic]).
    No
    

See Also

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