Skip to main content
Solved

substring extractor

  • June 3, 2014
  • 2 replies
  • 289 views

hlee1282
Participant
Forum|alt.badge.img
Hi all,

 

I have a field with the numberic part of an address. I would like to replace the last 2 digits with XX and combine it with the beginning part. I have gotten as far as using the SubstringExtractor to extract the last 2 characters, but how can I combine it with the first part?

 

 

Examples

 

I have:

 

123

 

12345

 

 

Need it to be:

 

1XX

 

123XX

 

 

What does the transformer do with the part of the string that doesn't get extracted???

 

 

Thanks!

 

 

 

Best answer by tdavis

If you just want to replace those last two to XX, then use the StringReplacer change "use regular expression" to Yes and text to match is ..$ and replacement text is XX.
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

Forum|alt.badge.img
  • Best Answer
  • June 4, 2014
If you just want to replace those last two to XX, then use the StringReplacer change "use regular expression" to Yes and text to match is ..$ and replacement text is XX.

hlee1282
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • June 4, 2014
Thank you tdavis! Works perfectly! 

 

 

Maybe you can help me with the StringSearcher transformer. I have my matched and notMatched. What is the attribute name to expose to put the notMatched records into another attribute?