Solved

stringsearch

  • 25 March 2019
  • 6 replies
  • 17 views

Hi all,

Can anyone explain which transformers to use, to find the index of a certain string in an attribute - BUT only the last occurrance, by looking forward and/or backward in the string. Unfortunately I have very little experience with RegEx.

icon

Best answer by ebygomm 25 March 2019, 11:24

View original

6 replies

Badge +10

I think in FME the easier way to do this is to use the stringsearcher to find all matches and store in a list. Then retrieve the index of the last match in the list

I think in FME the easier way to do this is to use the stringsearcher to find all matches and store in a list. Then retrieve the index of the last match in the list

@egomm Good idea, but the list will just contain equal items, so how do I get the index? As far as i can see, it's not a part of stringsearch output??

Badge +10

@egomm Good idea, but the list will just contain equal items, so how do I get the index? As far as i can see, it's not a part of stringsearch output??

The list should contain the indexes as well

I think in FME the easier way to do this is to use the stringsearcher to find all matches and store in a list. Then retrieve the index of the last match in the list

Hi again @egomm, Where do you get that list from as a result from Stringseacher? As you can see below, I only get a list of the seach strings (placering) found (_first_match) - not where they are in the searchstring (_response_body) !! How can I find the index?

Badge +10

Hi again @egomm, Where do you get that list from as a result from Stringseacher? As you can see below, I only get a list of the seach strings (placering) found (_first_match) - not where they are in the searchstring (_response_body) !! How can I find the index?

You need to set the All Matches list name in the StringSearcher

The list attributes will only be visible in the Feature Information window (on the right) not in the Table View. If you follow this with a list indexer with a value of -1 you will get the start index as an attribute

I think in FME the easier way to do this is to use the stringsearcher to find all matches and store in a list. Then retrieve the index of the last match in the list

@egomm, Thanks a lot - that worked.

Now it should be easy to pick up a specific number of chars from the string from the provided index position.

Reply