请输入您要查询的百科知识:

 

词条 Wildmat
释义

  1. Pattern matching operations

  2. Usage

  3. Examples

  4. See also

  5. External links

{{lowercase|title=wildmat}}{{Infobox software
| name = wildmat
| title = wildmat
| logo =
| screenshot =
| caption =
| collapsible =
| author =
| developer = Rich Salz
| released =
| discontinued =
| latest release version =
| latest release date =
| latest preview version =
| latest preview date =
| frequently updated =
| programming language =
| operating system =
| platform =
| size =
| language =
| status =
| genre = Pattern matching
| license =
| website =
}}

wildmat is a pattern matching library developed by Rich Salz. Based on the wildcard syntax already used in the Bourne shell, wildmat provides a uniform mechanism for matching patterns across applications with simpler syntax than that typically offered by regular expressions. Patterns are implicitly anchored at the beginning and end of each string when testing for a match.

Pattern matching operations

There are five pattern matching operations other than a strict one-to-one match between the pattern and the source to be checked for a match.

  • Asterisk () to match any sequence of zero or more characters.
  • Question mark (?) to match any single character.
  • Set of specified characters. It is specified as a list of characters, or as a range of characters where the beginning and end of the range are separated by a minus (or dash) character, or as any combination of lists and ranges. The dash can also be included in the set as a character if it is the beginning or end of the set. This set is enclosed in square brackets. The close square bracket (]) may be used in a set if it is the first character in the set.
  • Negation of a set. It is specified the same way as the set with the addition of a caret character (^) at the beginning of the test string just inside the open square bracket.
  • Backslash (\\) character to invalidate the special meaning of the open square bracket ([), the asterisk, backslash or the question mark. Two backslashes in sequence will result in the evaluation of the backslash as a character with no special meaning.

Usage

wildmat is most commonly seen in NNTP implementations such as Salz' own INN, also in unrelated software such as GNU tar.

The full wildmat syntax is unable to handle multibyte character sets, and poses problems when the text being searched may contain multiple incompatible character sets. A simplified version of wildmat oriented toward UTF-8 encoding has been developed by the IETF NNTP working group, to be included in an {{As of|2004|alt=upcoming}} standards document.

Examples

  • foo matches string containing "foo".
  • mini matches anything that begins with "mini" (including the string "mini" itself).
  • ??? matches any string of three and more letters.
  • [0-9a-zA-Z] matches every single alphanumeric ASCII character.
  • [^]-] matches a character other than a close square bracket or a dash.

See also

  • glob (programming)
  • Kleene star
  • Matching wildcards

External links

  • {{cite newsgroup|author=Rich Salz|newsgroup=comp.sources.misc|title=v17i079: wildmat-1.4 - a /bin/sh-style pattern matcher, Part01/01|message-id=1991Apr4.034350.3923@sparky.IMD.Sterling.COM|date=April 4, 1991}}
  • {{cite newsgroup|author=Rich Salz|newsgroup=comp.sources.misc|title=v17i034: wildmat - a /bin/sh-style pattern matcher, Part01/01|date=March 9, 1991|message-id=1991Mar9.044016.2409@sparky.IMD.Sterling.COM}}

1 : Pattern matching

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/12 1:51:04