# $str.grep Performs searches in arrays of strings via regular expression matching
Usage
    $str.grep(<match>,<strings>[,<flags>,<offset>])
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. If the offset is specified attempts to find a match in from position offset in every array's item. If offset is -1, the search starts at the last character; if -2, at the next to last character; etc. 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>,<offset:integer>])
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.2.0.6190 Documentation
Generated by root at Tue Sep 24 07:25:10 2013