tracker issue : CF-4120177

select a category, or use search below
(searches all categories and all time range)
Title:

Callback support missing for replaceNoCase(), reReplace() and reReplaceNoCase() functions. Also, the callback function should receive the "count of the current replacement operation".

| View in Tracker

Status/Resolution/Reason: To Fix//

Reporter/Name(from Bugbase): / ext-user (Vamseekrishna Nanneboina)

Created: 02/21/2016

Components: Language

Versions: 2016

Failure Type: Enhancement Request

Found In Build/Fixed In Build: Final /

Priority/Frequency: Major / Most users will encounter

Locale/System: ALL / Linux All,Mac 10 All,Solaris All,Win XP All

Vote Count: 5

Problem:
Callback support missing for replaceNoCase(), reReplace() and reReplaceNoCase() functions. Also, the callback function should receive the "count of the current replacement operation".

Method:

Result:

Expected:

Workaround:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4120177

External Customer Info:
External Company:  
External Customer Name:  
External Customer Email:

Attachments:

Comments:

+1 - Thanks very much, Vamsee, for filing this.
Vote by External U.
4485 | February 21, 2016 11:36:08 PM GMT
The fix is not working. Please check.
Comment by Poonam J.
4480 | May 09, 2016 04:06:48 AM GMT
Moving to CF13, as it includes language changes which will break the installation when the HF is applied.
Comment by Nikhil S.
4481 | May 10, 2016 01:01:53 AM GMT
*All caps*
Comment by Poonam J.
4482 | October 03, 2016 11:58:57 PM GMT
Nikhil. from your comment can I ascertain that this fix has already been developed? Also, in what way would it break existing code? Since it's just changing a string parameter to allow for a closure, it should be backwards compatible. Is there a spec for what the closure will receive for the reReplace() and reReplaceNoCase() functions? I would like to propose that they receive as their first argument, the same data structure currently returned by the reFind() and reFindNoCase() functions when "returnSubExpression" is set to true which is the following: A struct with keys "pos" and "len". Each are an array with elements for the position and length of the match (first element), and the position and length of any matched subexpressions in the subsequent elements. Furthermore, this data structure should be enhanced to contain a new key called "matches" which is an array of string to contain the matched text for each callback corresponding with the indexes of the other two arrays. The second argument to the closure should be the original string. The third argument to the closure should be the count of the current replacement operation. So 1 for the first match, 2 for the second match and so on. I have entered the following matching ticket in the Lucee JIRA system: https://luceeserver.atlassian.net/browse/LDEV-1088 If this implementation needs to differ from what's stated above, please comment here so I can update the Lucee ticket to match.
Comment by External U.
4483 | November 22, 2016 10:19:58 PM GMT
Hi Adobe, Can you please reply to Adam's comment on 11/22/2016 22:19:58 GMT? I, too, would like to know what the closure will receive. Thanks!, -Aaron P.S. Currently, my name isn't listed under my vote comment (where I'm thanking Vamsee for filing this for me). And Adam's name isn't under his comment either (But I know that's Adam's comment, just by reading thru it :)).
Comment by Aaron N.
4484 | July 10, 2017 12:08:25 AM GMT