Skip to main content

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

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.


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


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!


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.


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

stripofflastchar.fmw


Reply