Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: misc.fields - Function Up: misc - Tool Previous: misc.stripleadingblanks - Function


misc.patternmatch - Function



Package utility
Module misc
Tool misc


Find matching strings using shell expressions


Synopsis
patternmatch(pattern, strings)


Description
This pattern matching function uses the shell expression syntax familiar to anyone who has used a UNIX shell. In brief:

*
Matches any string, including the null string.
?
Matches any single character.

Note that [...] matches any one of the enclosed characters. A pair of characters separated by - matches any character lexically between the pair, inclusive. If the first character following the opening [ is a !, any character not enclosed is matched.

The following characters have a special meaning to the shell and cause termination of a word unless quoted:

;  &  (  )  |  ^  <  >  newline  space  tab

A character may be quoted (that is, made to stand for itself) by preceding it with a backslash (\) or inserting it between a pair of quote marks ('' or ""). For further definition of the syntax, see the UNIX man page for sh. This is a simple syntax that suffices for many applications. If a more capable matching syntax is needed, use the builtin regex capabilities of Glish.

This is implemented entirely in Glish and not the gmisc client.



Arguments

pattern   Pattern
    Allowed: Any shell expression
strings   Strings to be tested
    Allowed: String


Example
- dms.patternmatch ('12**', "12345 89712 123 12 11")
12345 123 12





next up previous contents index
Next: misc.fields - Function Up: misc - Tool Previous: misc.stripleadingblanks - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15