Search code examples
dmnfeel-language

Does the Feel language builtin string function 'replace' affect the first match or all occurrances of the search pattern?


The Decision Model and Notation Feel Language has many builtin functions. For strings, one function is replace. It accepts a search string, a regex pattern, a replacement string, and optional flags.

Does replace act only on the first regex match or does it replace all matches? The DMN version 1.3 specification, page 138, does not seem to address this.


Solution

  • In your question, it replaces all matches.

    Some other valid examples:

    replace("banana","a","o") = "bonono"
    

    taken as one of the agreed behaviour test cases, from the DMN TCK project.

    I agree in the DMN Specification document from OMG, it could list some more down-to-Earth examples :)