Skip to main content
Solved

stringsearch


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.

Best answer by ebygomm

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

View original
Did this help you find an answer to your question?

6 replies

ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • Best Answer
  • March 25, 2019

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


ebygomm wrote:

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??


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • March 25, 2019
fritspoulsen12 wrote:

@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


ebygomm wrote:

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?


ebygomm
Influencer
Forum|alt.badge.img+39
  • Influencer
  • March 25, 2019
fritspoulsen12 wrote:

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


ebygomm wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings