$str.grep

Emulates the GNU Regular Expression Parser
Usage
$str.grep(<match>,<strings>[,<flags>])
Description
Returns an array with the elements of <strings> which match the string <match>. <flags> can be any combination of the characters 's','w','r' and 'p'.
If the flag 'w' is specified then <match> is assumed to be a wildcard regular expression (with * and ? wildcards). If the flag 'r' is specified then <match> is assumed to be a standard regular expression. If none of 'w' and 'r' is specified then <match> is treated as a simple string to be searched in each element of the <strings> array. 'r' takes precedence over 'w'. If the flag 's' is specified the matches are case sensitive.
If the flag 'p' is specified the returned array will contain at its index 0 the text that matched the full pattern, and in the following array indexes the captured texts that matched each parenthesized subpattern.
The 'p' flag has effect only if used toghether with the 'r' flag.
Note that since almost any other variable type can be automatically cast to an array, then you can use this function also on scalars or hashes.
Syntax Specification
<array> $str.grep(<match:string>,<strings:array>[,<flags:string>])
Examples

    # Find all the nicknames starting with the letter A or a
    echo $str.grep("^a",$chan.users,"r")
    # Find the current CPU speed (on UNIX like machines only)
    echo $str.grep("MHz",$str.split($lf,$file.read("/proc/cpuinfo")))
    # simply check if the specified string matches a regular expression
    # (this in fact is a little tricky, but you will probably not notice it :D)
    if($str.grep("[st]+","test string","r"))echo "Yeah, it matches!"

See also
$array

Index, Functions
KVIrc 4.0.0 Documentation
Generated by mockbuild at Sun Apr 18 14:58:16 2010