Return-Path: X-Original-To: apmail-flex-users-archive@www.apache.org Delivered-To: apmail-flex-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9190B10048 for ; Thu, 7 May 2015 03:51:01 +0000 (UTC) Received: (qmail 30812 invoked by uid 500); 7 May 2015 03:51:01 -0000 Delivered-To: apmail-flex-users-archive@flex.apache.org Received: (qmail 30782 invoked by uid 500); 7 May 2015 03:51:01 -0000 Mailing-List: contact users-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@flex.apache.org Delivered-To: mailing list users@flex.apache.org Received: (qmail 30769 invoked by uid 99); 7 May 2015 03:51:00 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2015 03:51:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 6D2BB182584 for ; Thu, 7 May 2015 03:51:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.898 X-Spam-Level: ** X-Spam-Status: No, score=2.898 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id TZgN7bWRLUBy for ; Thu, 7 May 2015 03:50:49 +0000 (UTC) Received: from mail-ie0-f170.google.com (mail-ie0-f170.google.com [209.85.223.170]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 6AD5023152 for ; Thu, 7 May 2015 03:50:48 +0000 (UTC) Received: by iepj10 with SMTP id j10so27072836iep.0 for ; Wed, 06 May 2015 20:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=4ZDAVmSi+8KBovCVUympmEvhvHnoexOsXKhdVwy3F1U=; b=hro2hamDjaBe8T7mYNo1qT3/vwD87Lnx+Z+9leB+VKr/IlAcpV8+tb0JVCXPf1a8oC S/vworYDrR4SXp70PhZ5sbqfipWO5YFmu1KF/TyEnizMW8JcAbK30HIvaD7wJAxcZPi6 9p1jfFQXrOeomj3yR8/Q0sKn1TMtvKDstldT+jOJjad8O5+VcfZzpsqHvpk/pXLGFdcc 9uwVQEc6yP6T6nBhLvOOlPrE37DNSwftIwXTtR7zUlMZjfXF6Yp8N6GCM2OrhPVKG3wP CoJFJEj0Ron/W5/V/HjSuNdSnd3JknqI6OxpSJGSJ1kd4pSu0dRiqe4DkfWZty4w7NnD oR1w== MIME-Version: 1.0 X-Received: by 10.107.31.134 with SMTP id f128mr2342486iof.19.1430970647255; Wed, 06 May 2015 20:50:47 -0700 (PDT) Received: by 10.64.144.199 with HTTP; Wed, 6 May 2015 20:50:47 -0700 (PDT) In-Reply-To: References: Date: Thu, 7 May 2015 09:20:47 +0530 Message-ID: Subject: Re: Filtering ArrayCollection using RegExp From: Deepak MS To: "users@flex.apache.org" Content-Type: multipart/alternative; boundary=001a11403efa1d4821051575d173 --001a11403efa1d4821051575d173 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 'A' here would be dynamic. It actually can be anything which user enters in the search text input. Based on your suggestion, I tried this code, still not getting it right: if(tiSearch.text.indexOf('*') > -1) { var searchText:String =3D tiSearch.text.slice(0= , tiSearch.text.length - 1); dataLoader.atcDetailsList.filterFunction =3D function wildCardfilterATCs(item:Object):Boolean { var regExp:RegExp =3D new RegExp(searchText= , searchText+".*"); //searchText =3D 'A' return regExp.test( item['AtcDesc'] ); } } If I enter 'A*' it shows me all the items which has 'A' in it irrespective of it's location within the item. On Thu, May 7, 2015 at 12:53 AM, Alex Harui wrote: > IIRC, all words starting with A is =E2=80=98A.*=E2=80=99 > > > On 5/6/15, 6:30 AM, "Deepak MS" wrote: > > >Hi there, > >I'm trying to filter an AC using RegExp. The requirement is wild charact= er > >search. i.e, if I enter 'A*' (asterisk), then I need to display all item= s > >that start with 'A'. > > > >I haven't used RegExps much before. I feel I'm missing something here. > >Coudn't get much on net either. Can you kindly help me on this? > > > >This is the code: > > > >if(tiSearch.text.indexOf('*') > -1) > > { > > var searchText:String =3D tiSearch.text.slice(0, > >tiSearch.text.length - 1);//trying to remove * and use only the characte= rs > >here > > dataLoader.atcDetailsList.filterFunction =3D > >function wildCardfilterATCs(item:Object):Boolean > > { > > var regExp:RegExp =3D new RegExp(searchT= ext, > >"w*");//not working > > return regExp.test( item['AtcDesc'] ); > > } > > }else > > { > > dataLoader.atcDetailsList.filterFunction =3D > >function > >filterATCs(item:Object):Boolean > > { > > searchText =3D tiSearch.text > > var regExp:RegExp =3D new RegExp( searchText= , > >"i" > >); //this works fine, without asterisk. Lists all items that has search > >character anywhere in the item. > > return regExp.test( item['AtcDesc'] ); > > > > } > > } > > > >dataLoader.atcDetailsList.refresh(); > > --001a11403efa1d4821051575d173--