Difference between revisions of "Pattern Matching"

From The Foundry MODO SDK wiki
Jump to: navigation, search
Line 1: Line 1:
''modo'' features a basic yet powerful pattern matching system based loosely on that originally available in AmigaOS.  Some commands support pattern matching, as do the 'F' search fields in many parts of modo's user interface.
+
''modo'' features a basic yet powerful pattern matching system based loosely on the design from AmigaOS.  Some [[Command System|commands]] support pattern matching, as do the 'F' search fields in many parts of ''modo'''s user interface.
  
In this table, ''expression'' is defined as a single character, or characters wrapped in parentheses or square braces as described below.
+
The following table describes the syntax used by ''modo'''s pattern matching mechanism.  ''Expression'' is defined as a single character, or characters wrapped in parentheses or square braces as described below.
  
 
{| align="center"
 
{| align="center"

Revision as of 23:56, 1 April 2012

modo features a basic yet powerful pattern matching system based loosely on the design from AmigaOS. Some commands support pattern matching, as do the 'F' search fields in many parts of modo's user interface.

The following table describes the syntax used by modo's pattern matching mechanism. Expression is defined as a single character, or characters wrapped in parentheses or square braces as described below.

Syntax Description Example
Inputs Pattern Matches
* Zero or more of any characters. Apple, Apricot, Grape Ap* Apple, Apricot
# Zero or the next sub pattern. Ae, Ape, Appe, App, Axe A#pe Ae, Ape, Appe
? Any single character. a? will match any two-characer strings starting with a. #? means "any number of any characters", and is functionally identical to * Axe, Ape, Asp A?e Axe, Ape
~ Negates the following expression. For example, #~x? will match any two letter string except thoe starting with x. Similarly, ~(x?) will match anything except a two letter string beginning with x (so, xxa or ab but not xa). Axe, Ape, Asp A~xe Ape, Asp
( | ) Any one of the items separated by the vertical bar character. Any number of vertical bars can be used, including none. Axe, Ape, Abe b)e Axe, Abe
[abc] Any one of the characters inside the square braces. Axe, Ace, Abe, Abc, ACE A[bcBC]e Ace, Abe, ACE
[a-z] Any of the range of characters within the square braces. Multiple ranges cab be combined, such as [a-dA-Dxyz]. Axe, Ace, ABE, Ate A[a-kA-K]e Ace, ABE
' Escape from pattern matching. A[1], A[2], A(3) A'[?'] A[1], A[2]

Originally based on the description provided by the Amiga User Interface Guide, pages 108-110. Notable differences are that % is not currently supposed and a comma is not required between ranges in the [a-z] syntax.