El jueves, 3 de diciembre de 2015, 13:54:01 (UTC-6), Erik Schnetter 
escribió:
>
> You are looking for `filter`:
>
> filter(line->match(r"parameter", line), rLines)
>

Apparently this needs to be

filter(line->ismatch(r"3", line) != nothing, rLines)  

(replace "match" with "ismatch" to get a Boolean expression instead of a 
RegexMatch object).
 

>
> -erik
>
> On Thu, Dec 3, 2015 at 2:52 PM, Jason McConochie <jason.mc...@gmail.com 
> <javascript:>> wrote:
>
>> Is there grep for an Array of AbstractStrings?  See code below
>>
>>
>> # A. Read a file into memory (nLines pre-determined)
>>
>> fID=open(fName)
>>
>> iLine=0;
>>
>> rLines=Array(ASCIIString,nLines);
>>
>> while !eof(fID)
>>
>>   iLine+=1
>>
>>   rLines[iLine]=readline(fID)
>>
>> end
>>
>>
>> # B. Find all strings in rLines with "parameter"
>>
>> ???? Is something like this possible?
>>
>> indices=grep(rLines,r"parameter")
>>
>>
>>
>>
>
>
> -- 
> Erik Schnetter <schn...@gmail.com <javascript:>> 
> http://www.perimeterinstitute.ca/personal/eschnetter/
>

Reply via email to