> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of StevenLevithan > > >> One other question... can the results from named capture be used in a > >> replacement closure function? I.e., will you be able to do something > >> like str.replace(/(?P<name>)/,function(match){return match.name;}); ? > > > > The captured substrings with names are available as properties on the > > match result object, so that should work, yes. > > But the match result object is not available within a > replacement closure function, hence the question.
Sorry, brain fart on my part. Interesting point. Will look into it; expect another ticket tomorrow. --lars > At least in > ES3, arguments[0] is a string primitive containing the entire > match (i.e. backreference zero). It could be changed to a > String object and have the named backreferences attached to > it as properties (which is how I handle the issue in my > http://stevenlevithan.com/regex/xregexp/ XRegExp library), > but this is fundamentally a different thing, and might have > some obscure potential for compatibility issues. _______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
