regexp_code (library)

Usage and interface

Documentation on exports

PREDICATEmatch_shell/3

Usage:match_shell(Exp,IN,Rest)

Matches IN against Exp. Rest is the longest remainder of the string after the match. For example, match_shell("??*","foo.pl",Tail) succeeds, instantiating Tail to "o.pl".

PREDICATEmatch_shell/2

Usage:match_shell(Exp,IN)

Matches completely IN (no tail can remain unmatched) against Exp similarly to match_shell/3.

PREDICATEmatch_posix/2

Usage:match_posix(Exp,IN)

Matches completely IN (no tail can remain unmatched) against Exp similarly to match_posix/3.

PREDICATEmatch_posix/4

Usage:match_posix(Exp,In,Match,Rest)

Usage:match_posix_rest(Exp,IN,Rest)

Matches IN against Exp. Tail is the remainder of the string after the match. For example, match_posix("ab*c","abbbbcdf",Tail) succeeds, instantiating Tail to "df".

Usage:match_posix_matches(Exp,IN,Matches)

Matches completely IN against Exp. Exp can contain anchored expressions of the form \(regexp\). Matches will contain a list of the anchored expression which were matched on success. Note that since POSIX expressions are being read inside a string, backslashes will have to be doubled. For example,

?- match_posix_matches("\(aa|bb\)\(bb|aa\)", "bbaa", M).
M = ["bb","aa"] ? ;
no

?- match_posix_matches("\(aa|bb\)\(bb|aa\)", "aabb", M).
M = ["aa","bb"] ? ;
no

Usage:match_struct(Exp,IN,Rest,Tail)

Matches IN against Exp. Tail is the remainder of the list of atoms IN after the match. For example, match_struct([a,*(b),c],[a,b,b,b,c,d,e],Tail) succeeds, instantiating Tail to [d,e].

PREDICATEmatch_term/2

Usage:match_term(Term1,Term2)

Tests if two terms Term1 and Term2 match using shell regular expressions.

    Usage:replace_first(IN,Old,New,Resul)

    Replace the first occurrence of the Old by New in IN and copy the result in Resul.

    PREDICATEreplace_all/4

    Usage:replace_all(IN,Old,New,Resul)

    Replace all occurrences of the Old by New in IN and copy the result in Resul.

    Usage:shell_regexp(P)

    P is a shell regular expression to match against.

      Usage:posix_regexp(P)

      P is a posix regular expression to match against.

        Usage:struct_regexp(P)

        P is a struct regular expression to match against.

          Documentation on imports

          This module has the following direct dependencies: