Pattern (regular expression) matching -deprecated version

Author(s): The CLIP Group.

(Deprecated - please use the new "regexp" package instead.)

This library provides facilities for matching strings and terms against patterns (i.e., regular expressions).

Usage and interface

Documentation on exports

PREDICATE

Usage:match_pattern(Pattern,String)

Matches String against Pattern. For example, match_pattern("*.pl","foo.pl") succeeds.

  • The following properties should hold at call time:
    (patterns:pattern/1)Pattern is a pattern to match against.
    (basic_props:string/1)String is a string (a list of character codes).

PREDICATE

Usage:match_pattern(Pattern,String,Tail)

Matches String against Pattern. Tail is the remainder of the string after the match. For example, match_pattern("??*","foo.pl",Tail) succeeds, instantiating Tail to "o.pl".

  • The following properties should hold at call time:
    (patterns:pattern/1)Pattern is a pattern to match against.
    (basic_props:string/1)String is a string (a list of character codes).
    (basic_props:string/1)Tail is a string (a list of character codes).

PREDICATE

Usage:case_insensitive_match(Pred1,Pred2)

Tests if two predicates Pred1 and Pred2 match in a case-insensitive way.

    PREDICATE

    Usage:letter_match(X,Y)

    True iff X and Y represents the same letter

      REGTYPE
      Special characters for Pattern are:
      *
      Matches any string, including the null string.
      ?
      Matches any single character.
      [...]
      Matches any one of the enclosed characters. A pair of characters separated by a minus sign denotes a range; any character lexically between those two characters, inclusive, is matched. If the first character following the [ is a ^ then any character not enclosed is matched. No other character is special inside this construct. To include a ] in a character set, you must make it the first character. To include a `-', you must use it in a context where it cannot possibly indicate a range: that is, as the first character, or immediately after a range.
      |
      Specifies an alternative. Two patterns A and B with | in between form an expression that matches anything that either A or B will match.
      {...}
      Groups alternatives inside larger patterns.
      \
      Quotes a special character (including itself).

      Usage:pattern(P)

      P is a pattern to match against.

        PREDICATE

        Usage:match_pattern_pred(Pred1,Pred2)

        Tests if two predicates Pred1 and Pred2 match using regular expressions.