Re: Map function with regular expression

2010-06-01 Thread Steven . Prentice
Cheers Dave, that is exactly what I am after :) From: Dave Cottlehuber To: user@couchdb.apache.org Date: 01/06/2010 07:13 PM Subject: Re: Map function with regular expression >>//regular expression to ensure a store name starts with "C" and ends >> with "k&quo

Re: Map function with regular expression

2010-06-01 Thread Steven . Prentice
I am not getting any results at all, will try your suggestions :) From: Sebastian Cohnen To: user@couchdb.apache.org Date: 01/06/2010 07:06 PM Subject: Re: Map function with regular expression Hey Steven, I have not tested your code, but what seems to be the problem? are you getting

Re: Map function with regular expression

2010-06-01 Thread Dave Cottlehuber
>>    //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/); I'm a perl guy so assuming http://www.regular-expressions.info/anchors.html this is accurate then: the regex above (assuming perl & javascript regex

Re: Map function with regular expression

2010-06-01 Thread Sebastian Cohnen
Hey Steven, I have not tested your code, but what seems to be the problem? are you getting errors or simply not the output you anticipated? Some hints though: - you can use log() to emit messages to couchdb's logfile - you should always use guards (like if (doc.Stores) { ... }) otherwise you can

Map function with regular expression

2010-06-01 Thread Steven . Prentice
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