Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 26792 invoked from network); 1 Jun 2010 07:10:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Jun 2010 07:10:05 -0000 Received: (qmail 11758 invoked by uid 500); 1 Jun 2010 07:10:04 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 11376 invoked by uid 500); 1 Jun 2010 07:10:02 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 11368 invoked by uid 99); 1 Jun 2010 07:10:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jun 2010 07:10:01 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=AWL,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of Steven.Prentice@nextgen.net designates 203.18.147.131 as permitted sender) Received: from [203.18.147.131] (HELO smtp12.NextGen.Net) (203.18.147.131) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jun 2010 07:09:53 +0000 Received: from locutus.nextgen.net ([203.18.147.35]) by smtp12.NextGen.Net with ESMTP id 2010060117093129-283162 ; Tue, 1 Jun 2010 17:09:31 +1000 To: user@couchdb.apache.org MIME-Version: 1.0 Subject: Map function with regular expression X-KeepSent: 6AE3D3B4:2E3D32F2-CA257735:00271309; type=4; flags=0; name=$KeepSent X-Mailer: Lotus Notes Release 8.0.1 February 07, 2008 Message-ID: From: Steven.Prentice@nextgen.net Date: Tue, 1 Jun 2010 17:09:30 +1000 X-MIMETrack: Serialize by Router on Locutus/NextGen Systems at 01/06/2010 05:09:31 PM, Serialize complete at 01/06/2010 05:09:31 PM, Itemize by SMTP Server on SMTP12/NextGenEXT at 01/06/2010 17:09:31, Serialize by Router on SMTP12/NextGenEXT at 01/06/2010 17:09:53, Serialize complete at 01/06/2010 17:09:53 Content-Type: multipart/alternative; boundary="=_alternative 00275263CA257735_=" --=_alternative 00275263CA257735_= Content-Type: text/plain; charset="US-ASCII" Hi, Ive got a document containing an array and want to perform a regex on an array item called name, it is located in the Stores field what ive got at the moment is... function(doc) { for (id in doc.Stores) { //regular expression to ensure a store name starts with "C" and ends with "k" var strqry = doc.Stores[id].name.match(/^C([a-z]*)k/); if (strqry) { emit(doc.Stores[id].name, doc.product_name + " qty: " + doc.Stores[id].item_count); } } } a javascript regex validator told me that that regex is correct, I think it may be something wrong with the way that I am pointing the regex to the "stores[id].name" Cheers :) --=_alternative 00275263CA257735_=--