Hi Michael 

> On 22 Oct 2019, at 15:50, Barrie Selack <bar...@rockhopper.com> wrote:
> 
> Michael,
> 
> Could you use remove_begining and remove_ending?
> 
> https://freemarker.apache.org/docs/ref_builtins_string.html#ref_builtin_remove_ending
> 
> Barrie
> 
> 
> 
> On Tue, Oct 22, 2019 at 10:31 AM Riehemann, Michael <
> michael.riehem...@coremedia.com> wrote:
> 
>> Hello,
>> 
>> I have a Feature Request for the string built-in "replace".
>> 
>> This built-in has some additional flags, see
>> https://freemarker.apache.org/docs/ref_builtins_string.html#ref_builtin_string_flags
>> 
>> Example:
>> We have string, in which we want to remove the first and last appearance
>> of a substring.
>> The first one is possible, but not the last one. Or do I miss something
>> here?

You could use a combination of keep_before_last and keep_after_last :)

— Denis. 

>> Code:
>> <#assign testString="start some text start end some more lines end again"
>> />
>> ${testString?replace("start", "", "f")} = some text start end some more
>> lines end again
>> 
>> It would be nice to have a flag "l" to get the last one.
>> ${testString?replace("end", "", "l")} = start some text start end some
>> more lines again
>> 
>> 
>> What do you think?
>> 
>> Thanks in advance,
>> 
>> Michael Riehemann
>> 

Reply via email to