Skip to main content
Solved

Splitting a string using the RegxAttributeSplitter, regex positive lookahead leaves delimiter in the second list and negative lookahead stops process completely

  • November 14, 2020
  • 2 replies
  • 31 views

Forum|alt.badge.img

Hi, I am using the RegxAttributeSplitter. My delimiter has to be digits followed by a whitespace. I have used the positive lookahead Regex (?=\\d(\\s)) but instead of splitting the string and keeping the delimiter in the first list, the delimiter moves into the second list. I need my delimiter to remain within the first list, I thought the answer would be to use Regex negative lookahead (?!\\d(\\s)) but the negative lookahead stalls the transformer completely and produces no result. Any clues what Regex I should be using? I have also tried using Regex in the StringReplacer but no positive results here either. Below is sample of the string..

 

H02.CCU066 Sluice (Shared 2,Rooms)

 

H02.THD067 Treatment Area - 14,Spaces

 

Yellow highlight is the delimiter moving to the second listFME Regex issue

Best answer by ebygomm

I'm not familiar with the RegxAttributeSplitter

 

I'd use something like the following to match groups in the StringSearcher

([\w\d]*\.[\w\d]*)\s(.*)

So first group matches letters or numbers followed by a dot followed by letters or numbers. Second group matches everything else after a space.

 

Make sure to set thesubexpresion list name under advanced and then rename list{0}.part to Room Number and list{1].part to Name

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

2 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • November 15, 2020

I'm not familiar with the RegxAttributeSplitter

 

I'd use something like the following to match groups in the StringSearcher

([\w\d]*\.[\w\d]*)\s(.*)

So first group matches letters or numbers followed by a dot followed by letters or numbers. Second group matches everything else after a space.

 

Make sure to set thesubexpresion list name under advanced and then rename list{0}.part to Room Number and list{1].part to Name


Forum|alt.badge.img
  • Author
  • November 16, 2020
ebygomm wrote:

I'm not familiar with the RegxAttributeSplitter

 

I'd use something like the following to match groups in the StringSearcher

([\w\d]*\.[\w\d]*)\s(.*)

So first group matches letters or numbers followed by a dot followed by letters or numbers. Second group matches everything else after a space.

 

Make sure to set thesubexpresion list name under advanced and then rename list{0}.part to Room Number and list{1].part to Name

Thank you @ebygomm​  this worked and got the desired results. 


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