I have an FME process that is duplicating some values in an attribute. When I try to use regex in FME to clean it up it is deleting the separator (see screengrab below). Any ideas on how I can change the regex or process in FME to just get the required values.

So from


I just want


The value in AttributeManager from FME is @ReplaceRegEx(@Value(Name_Ids),"(?:^|\G)(\b\w+\b),?(?=.*\1)\|",\1)

I have tried to replace \b),?(? with \b)\|(?to use the | seperator but that doesn't work either. This is based on https://superuser.com/a/1343524/639219

The regex tester is https://regex101.com/r/1YhC59/1

enter image description here

3 Answers 3


You are almost there, instead of


you need

  • Thanks but for my future knowledge can you let me know what the ` \1` at the end does as against ""? That's the only difference I noticed.
    – GeorgeC
    Commented Aug 26, 2020 at 22:54
  • 1
    I don’t know, fiddled around and it just worked :) Commented Aug 26, 2020 at 23:08

You could use a PythonCaller as well to remove your duplicate values:

def processFeature(feature):
    ids = feature.getAttribute('Name_Ids')
    feature.setAttribute('Name_Ids', '|'.join(list(dict.fromkeys(ids.split('|')))))

enter image description here


Without regex you could always use:

  • An AttributeSplitter transformer to turn the attribute into a list
  • A ListDuplicateRemover transformer to remove duplicate list entries
  • A ListConcatenator transformer to turn the list back into an attribute

But also, could we stop the duplication happening from the very start? Can you clarify how that string is being created?

  • Wow, 3 transformers for a simple task ;-) ... would be nice if Attribute Manager could support Python!
    – christoph
    Commented Aug 25, 2020 at 15:58
  • 1
    Or maybe we could ask Don and Dale for an expression engine with custom Python functions like QGIS offers us... only thinking loud.
    – christoph
    Commented Aug 25, 2020 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.