Skip to main content
Solved

Strings with numbers


pushpa
Contributor
Forum|alt.badge.img+9

I have a Shapefile with 9000 records and one of the attribute columns contain strings (numbers and letters). Column width is set to 4 characters

I need to find all records with last character is a "letter" and delete that letter.

ie:

ST4W

S4W

Above records I would like to delete "W" from the records

Could someone help me to do this using FME?

thanks

Best answer by erik_jan

You can use the StringReplacer, use the regular expression [a-zA-Z]$ to remove the last character if it is in the mentioned range and replace with nothing. Or use [a-z]$ and case sensitive No.

View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

5 replies

erik_jan
Contributor
Forum|alt.badge.img+19
  • Contributor
  • Best Answer
  • January 27, 2016

You can use the StringReplacer, use the regular expression [a-zA-Z]$ to remove the last character if it is in the mentioned range and replace with nothing. Or use [a-z]$ and case sensitive No.


davideagle
Contributor
Forum|alt.badge.img+21
  • Contributor
  • January 27, 2016

SubStringExtractor to extract the 4th character to new attribute.

AttributeClassifier to test that attribute to see if its Alphabetic.

Records that pass go through another SubStringExtractor and extract values 0 to 2 or 0 to -2 from the original attribute to a new attribute or overwrite the old one.

Or do some Regex magic...no doubt about to appear below this post...


davideagle
Contributor
Forum|alt.badge.img+21
  • Contributor
  • January 27, 2016
davideagle wrote:

SubStringExtractor to extract the 4th character to new attribute.

AttributeClassifier to test that attribute to see if its Alphabetic.

Records that pass go through another SubStringExtractor and extract values 0 to 2 or 0 to -2 from the original attribute to a new attribute or overwrite the old one.

Or do some Regex magic...no doubt about to appear below this post...

or above this post... I was too slow!


pushpa
Contributor
Forum|alt.badge.img+9
  • Author
  • Contributor
  • January 27, 2016
erik_jan wrote:

You can use the StringReplacer, use the regular expression [a-zA-Z]$ to remove the last character if it is in the mentioned range and replace with nothing. Or use [a-z]$ and case sensitive No.

Thanks. not sure what I am doing wrong,

I didn't get the results I expected.


davideagle
Contributor
Forum|alt.badge.img+21
  • Contributor
  • January 27, 2016

Here you go if you want to try it with a couple of standard Transformers.

stripofflastchar.fmw


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