SteveSanderson/knockout — Issue #266: Regex in isWriteableValue could be improved?
Author: GilesBradshaw
Created: 2012-01-10 02:42:36+00:00
State: open

The function isWriteableValue(expression) compares an expression with a regex to find out if it is writaable. I don't understand regexes however in my application it was deciding that my expressions were not writeable when they should be so I think the regex could do with improvement.

The regex is /^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i;

An example of one of my writeable expressions that the function decided was not writeable is

"$parent.relations.relation('Parents').new"