Skip to main content
Solved

StringSearcher only returning the first number in the string

  • July 23, 2019
  • 2 replies
  • 28 views

dbryantgeo
Contributor
Forum|alt.badge.img+7

I am reading the source file from an SFTP folder and storing it into an attribute for the purposes of later downloading the right file (as the folder read may contain various files).

I use a StringSearcher transformer twice, once to identify that the files that are an xlslx and again to try and identify the date that is contained in the filename. I'll later discard the older files and only read in and store data from the newest file.

The filenames are formatted like Test_Test_240519.xlslx but the logger/inspector suggests that only the first number is being returned in the destination attribute.

The regex is a simple /d. I have also tried [0-9].

We're currently on FME 2017.0.1.1 but will be upgrading shortly - maybe this is an old bug but it seems odd that I can't find anything about it online?

Best answer by ebygomm

If you want to return the digits in "Test_Test_240519.xlslx" the regex needs to be [0-9]+ or \\d+

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.

2 replies

ebygomm
Influencer
Forum|alt.badge.img+44
  • Influencer
  • 3427 replies
  • Best Answer
  • July 23, 2019

If you want to return the digits in "Test_Test_240519.xlslx" the regex needs to be [0-9]+ or \\d+


dbryantgeo
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • 24 replies
  • July 25, 2019

@egomm thank you very much, regex is obviously not my strong suit.