Question

What transformer can I use, to keep all columns except one, which uses a "Regular Expression" to keep part of the string.


Badge

input String is :

10303 ARLINGTON AVE,RIVERSIDE, CA 92505Census Tract: 0410.03

 

Output String needs to be:

10303 ARLINGTON AVE,RIVERSIDE, CA 92505

 

I'm using the StringSearcher with the follow RegEx

([A-Za-z0-9]+( [A-Za-z0-9]+)+),[A-Za-z]+, CA \\s\\d\\d\\d\\d\\d

 

The result I'm getting is empty.


5 replies

Userlevel 2
Badge +11

Hi @lapriverside​ I would use an AttributeSplitter, splitting by the word Census. The default attribute that you'll get will be _list{0}, which you can demote out of the list with a ListIndexer, and/or use an AttributeRenamer afterwards.

Badge

Thank you for your help Dan! I'm very new to FME.

I'm still researching how to get the "Census Tract: nnnn.nn" as a string removed as the fields are all a consistent count of 21 characters from the RIGHT.

Not getting the right list yet.

 

 

Badge

I do see a regex filter which I do haveI do see a regex filter that I do have for the front characters I want to keep

Userlevel 2
Badge +11

There's no need for regex. Everything to the left of 'Census' will be the new value in the first element of the list:image

Userlevel 1
Badge +21

Whilst not strictly necessary to use regex it's quite straightforward to just use a ReplaceRegEx statement to replace the word Census and everything after it with nothing

@ReplaceRegEx(@Value(string),Census.*,"")

 If you wanted to use the string searcher you could use the following regex which will match everything preceding the word Census

.*(?=Census)

 

Reply