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
  • 86 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

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+44
  • Influencer
  • 3427 replies
  • 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
  • 2 replies
  • November 16, 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

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