/
ColdC/Functions/
ColdC/Structure/
<head><title>ColdC: Function/Method Reference: match_pattern()</title></head>

<body>

<h1 align=center><a href="/ColdC/">ColdC</a>: <a href="/ColdC/Functions/">Function/Method Reference</a>: match_pattern()</h1>

<hr>

<p>
<font size=+1><i>LIST</i> <b>match_pattern</b>(<i>STRING <b>pattern</b>, STRING <b>string</b></i>)</font>

<p>This function matches the wildcard pattern <VAR>pattern</VAR> against
<VAR>string</VAR>.  A wildcard pattern is a string with asterixes (<SAMP>`*'</SA
MP>)
signifying wildcards.  A regular character matches itself, while a wildcard
matches any number of arbitrary characters.  The return value of
<CODE>match_pattern()</CODE> is a list of the substrings of <VAR>string</VAR>
which matched the wildcards in <VAR>pattern</VAR>, or <CODE>0</CODE> if the
match fails.
<P>
<CODE>match_pattern()</CODE> allows you to do simple character-based matching.
For matching against command formats, however, you should use the
<CODE>match_template()</CODE> function.
<P>
Examples:
<P>
<PRE>
match_pattern("*", "foobar")
=&gt; ["foobar"]

match_pattern("foo * bar * baz", "foo quux bar quuux baz")
=&gt; ["quux", "quuux"]

match_pattern("foo * bar", "baz")
=&gt; 0
</PRE>

<p><hr size=4><p align=center><i>Last Modified on 24 Mar 1996</i>
<br><i>Copyright &copy; 1995, 1996, Brandon Gillespie</i>
</body>