Skip to main content
I have a value of FAIRFIELD WORKS, FAIRFIELD, AL 35064 that I need to change to FAIRA.  However I am getting FAIRA 35064.  I have my string replacer set as follows

 

 

Text to Find: FAIRFIELD WORKS, FAIRFIELD, AL 35064

 

Replacement Text: FAIRA

 

Use regular Expressions: No

 

Case Sensitive: No

 

 

How can I get rid of 35064.

 

 

thanks

 

Dan
regexp = (.*)\\s\\d*

 

 

Use regular Expressions: YES

 

 

expose or use creator or renamer on "matched_parts{0}"
does this work with conditional parameters?  I have other values in the field such as Warren, OH that do not need changed or do I need to add a Tester

 

 
Hi Dan,

 

 

Please check the input attribute value.

 

If the attribute stores "FAIRFIELD WORKS, FAIRFIELD, AL 35064 35064" (the number is duplicated), the resulting string will be "FAIRA 35064" naturally. 

 

 

Takashi
Lol Takashi,

 

 

i changed the regexp to (Âa-zA-Z,\\s]*)\\s\\d*

 

(FME regexp flavor does'nt want to do

 

 (.*)\\s\\d* or (o\\w,\\s]*)\\s\\d* Though in other aplications it works like above)

 

 

 

 

If u have specific objects that need changed u need to test for those yes.

 

In conditional you need to use different aproach, u can  use tcl string and listfunctions.

 

Though this is somewhat more complex

 

 

You could do like conditional:

 

test condition: 

 

@Value(adres) like %FAIRFIELD%

 

outputfield:@Evaluate(ostring replace {@Value(tst)} @Evaluate(Vlindex {@Evaluate(@Evaluate( regexp -indices {(.*)\\s\\d*} {@Value(tst)} M SM])==1?"$SM":"none")} 0]) @Evaluate(qlindex {@Evaluate(@Evaluate( regexp -indices {(ta-zA-Z,\\s]*)\\s\\d*} {@Value(tst)} M SM])==1?"$SM":"none")} 1]) {@Value(Replacement)}])

 

 

...;)

 

i set a attribute @Value(Replacement) to "FAIRA "

 

 

this replaces "FAIRFIELD WORKS, FAIRFIELD, AL 35064" to "FAIRA 35064"

 

 

You might not want to go there and just use transformers: tester, stringsearchers and stringreplacers.

 

 

Reply