Skip to main content
Solved

stringsearch

  • March 25, 2019
  • 6 replies
  • 212 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.

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3429 replies
  • 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


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+44
  • Influencer
  • 3429 replies
  • March 25, 2019

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


ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3429 replies
  • March 25, 2019

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.