photools.com Community

IMatch Bug Reports and Feature Requests => Feature Requests => Archive (Feature Requests) => Topic started by: lenmerkel on August 26, 2014, 02:25:32 AM

Title: Scripting: IMRegExp.Replace - parameter for maximum occurences to replace
Post by: lenmerkel on August 26, 2014, 02:25:32 AM
The IMRegExp class is a very powerful and straightforward 'helper' for using regular expressions in scripts. The Replace method always replaces All occurences of the matched text. Sometimes though, I only want to replace the First occurence of the matched text.

Can we have an optional integer parameter (MaxReplacements)? If the parameter isn't provided, default to All?
Title: Re: Scripting: IMRegExp.Replace - parameter for maximum occurences to replace
Post by: Mario on August 26, 2014, 07:39:32 AM
Can't this be expressed in the RegExp directly?
Title: Re: Scripting: IMRegExp.Replace - parameter for maximum occurences to replace
Post by: lenmerkel on August 26, 2014, 11:09:56 PM
Duh!  :-[

Of course - step away, come back later, look at it from a different direction - works every time . . .

Please mark this as SOLVED.