Skip to main content
Question

Getting text between two characters

  • December 21, 2018
  • 2 replies
  • 600 views

I have some data I need to extract some text from, it looks like this:

 

 

ABC1D, 520 [78580]|XD, 2-6 [DEAD]

Info in the brackets can also look like [211 X] and [95338 CO]

What I'm trying to do it drop everything except for what is in the brackets, and then filter out/ignore DEAD, and use the number to join(or query, I'm not sure which would be best yet) to another table; or in the case of 211 X match to a different table, or 95338 CO would trigger the workbench to write to a table in SQL. But for now what I need is to get that number in the bracket out to use in FME.

 

 

Thank you
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

ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • December 21, 2018

A string searcher with some regex to retrieve the values between square brackets would work here. As long as it's always the first set of square brackets in your string it would be output as the matched attribute

(?<=\[).*?(?=\])

 


  • Author
  • December 21, 2018

A string searcher with some regex to retrieve the values between square brackets would work here. As long as it's always the first set of square brackets in your string it would be output as the matched attribute

(?<=\[).*?(?=\])

 

Thank you very much. I wish I had asked hours ago.