Cheers Dave, that is exactly what I am after :)


From:
Dave Cottlehuber <[email protected]>
To:
[email protected]
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"
>>    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 are similar) is 
actually:

match on starting with capital C, followed only by 0 or more lower
case letters, then k. Your pattern is not terminated at the end of the
string, so CookIslands would match. Not sure if that's what you want
or not. This might be more your needs  - match capital C followed by 0
or more characters and lower k followed by end of string.

/^C.*k$/

A+
Dave


Reply via email to