Skip to main content
Solved

How to extract the variable part of an ID with a common prefix?

  • January 27, 2026
  • 5 replies
  • 75 views

vdbruben94
Participant
Forum|alt.badge.img+4

In the column 'knoopnr', each feature consists of a fixed ID (in this example 'HT005500') and a variable ID (B1, B2, BL1, ...). The fixed ID is therefore identical for every row within a project, but it differs from project to project. In another project, for example, the fixed ID could be 'KWL735' for every row. Is it possible to identify the fixed ID and retain only the variable ID?

Best answer by ebygomm

If you don’t mind a bit of python, it’s very easy to get the common prefix using that

Once you’ve got that you can use it in a stringreplacer to remove it and just keep the variable section

(Of course you could do it all in python too)

 

*It might need a bit of modification to handle cases where the entire value is numeric

5 replies

danilo_fme
Celebrity
Forum|alt.badge.img+54
  • Celebrity
  • January 28, 2026

Hi ​@vdbruben94 

 

Please, try to use the transformer StringSearcher.

 

Thanks in Advance,

Danilo


vdbruben94
Participant
Forum|alt.badge.img+4
  • Author
  • Participant
  • January 28, 2026

Hi Danilo, thanks for the help. The StringSearcher will work in most cases, but it also happens that the variable ID is not always composed of letters followed by numbers. Sometimes it consists only of numbers, sometimes only of letters, etc.

The only constant is that the fixed ID is identical for all rows. Below is an example dataset:

knoopnr
HT005500B1
HT005500BL2
HT00550023
HT005500R
HT005500D01A
HT005500D6
HT00550001

ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • Best Answer
  • January 28, 2026

If you don’t mind a bit of python, it’s very easy to get the common prefix using that

Once you’ve got that you can use it in a stringreplacer to remove it and just keep the variable section

(Of course you could do it all in python too)

 

*It might need a bit of modification to handle cases where the entire value is numeric


vdbruben94
Participant
Forum|alt.badge.img+4
  • Author
  • Participant
  • January 28, 2026

This was exactly what I needed — thanks for the help!


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • January 28, 2026

I was curious about a pure FME solution, although i think it would not measure up speed wise to the above