Skip to main content
Solved

Extract text from string in two different attributes

  • September 12, 2016
  • 4 replies
  • 76 views

Forum|alt.badge.img

Hello All,

I have excel spreadsheet that contains attributes like

Trackcomment O: from 105 to 160 O: from U to S on 117 O: from U to S on 135 O: from S to U on 144 P: from 101 to 111OT O: from U to S on 146BD

I want to create two new attributes (Columns) that contain middle part of the string (105 or U to S or S to U) and end of a string (160 or 111OT or 146BD) in two different excel columns (Attributes).

I am facing two challenges. I used stringsearcher that extracts the last number of trackcomments but missing if there is any alpha character and the second stringsearcher just extracts if it is U to S or S to U but it is missing if the middle part has a number. Please see the attached screenshot. I would appreciate the help.

GGoraya

Best answer by itay

Hi @gsgoraya,

One way to do it is using attribute splitters, since the catch is the varation in the data, so I basically make it equal and then apply the same logic.

Hope this helps,

Itayextract-text-from-string-in-two-different-attribut.fmw

View original
Did this help you find an answer to your question?

4 replies

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • Best Answer
  • September 12, 2016

Hi @gsgoraya,

One way to do it is using attribute splitters, since the catch is the varation in the data, so I basically make it equal and then apply the same logic.

Hope this helps,

Itayextract-text-from-string-in-two-different-attribut.fmw


Forum|alt.badge.img
  • Author
  • September 12, 2016
itay wrote:

Hi @gsgoraya,

One way to do it is using attribute splitters, since the catch is the varation in the data, so I basically make it equal and then apply the same logic.

Hope this helps,

Itayextract-text-from-string-in-two-different-attribut.fmw

Thank you for your help. It works.

GGoraya


takashi
Influencer
  • September 13, 2016
gsgoraya wrote:

Thank you for your help. It works.

GGoraya

Hi @gsgoraya, an excellent solution has been provided already by Itay, but I still think that the StringSearcher may be an option in this case. e.g.

0684Q00000ArN0kQAF.png

Regular Expression:

 

from\s+(.+)\s+[^\s]+\s+([^\s]+)$
FYI.

itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • September 14, 2016
takashi wrote:
Hi @gsgoraya, an excellent solution has been provided already by Itay, but I still think that the StringSearcher may be an option in this case. e.g.

0684Q00000ArN0kQAF.png

Regular Expression:

 

from\s+(.+)\s+[^\s]+\s+([^\s]+)$
FYI.
Hi @takashi excellent alternative! 

 

I am always hesitant to use the string searcher because of possible data variations and therefore the solution robustness.

 

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings