From 3fb12ca2c704d18d434b417d549122325e78225d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 2 Feb 2007 23:48:47 +0000 Subject: Enhance the :requirements functionality in #map() to allow regexps with capturing groups: the first non-nil capture will be passed on as the corresponding parameter value, instead of the whole matched expression. See ChangeLog and documented source for details. --- ChangeLog | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index 3ca18500..ababc59d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2007-02-03 Giuseppe Bilotta + + * Plugin message mapper: Enhancements to the :requirements option. + When the requirement of a parameter is a regular expression with + capturing groups /(...)/, the corresponding map parameters will be + assigned (by default) the first non-nil capture instead of the whole + regular expression. If a specific capture group is desired instead, + the requirement should be in the form + [/some regexp/, integer_index_of_the_desired_group] + or in the form + { + :regexp => /some regexp/, + :index => integer_index_of_the_desired_group + } + and a nil index will still give the default behavior. + If you want the whole regular expression to be the matched parameter + value, there are three options: use an index of 0, wrap the whole + regular expression in a capturing group, or use non-capturing groups + /(?:...)/. The latter is preferred because it's much faster. + When exploiting the capturing groups feature, please try to remember + to use /\s+/ instead of plain spaces / /, unless it's absolutely + necessary to have single spaces. + 2007-02-02 Giuseppe Bilotta * Plugin message mapper: Requirements (as set by the :requirements -- cgit v1.2.3