Skip to main content
Solved

How to replace string? From "Toi et Moi (Villa)" to "(Villa) Toi et Moi"

  • September 19, 2018
  • 7 replies
  • 13 views

Forum|alt.badge.img

Hi FME experts,

 

 

I'm having difficulties updating below:

 

Left is what I currently have, right is what I'd like to have. Have Want Toi et Moi (Villa) (Villa) Toi et Moi Wilgenerf ('t) Landhuis ('t) Wilgenerf Landhuis Gheestelic Hof (Het) (Het) Gheestelic Hof

 

So if it finds anything in between brackets, take that and put it in front of the string.

 

I've been trying the StringReplacer with the following RegEx: (\\(.*\\)) - but no luck so far.

Cheers,

 

Ed

Best answer by david_r

Try the following in a StringReplacer. Text to replace:

(.*)\s*(\(.*\))

Replacement text:

\2 \1

0684Q00000ArLBMQA3.png

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.

7 replies

david_r
Celebrity
  • 8394 replies
  • Best Answer
  • September 19, 2018

Try the following in a StringReplacer. Text to replace:

(.*)\s*(\(.*\))

Replacement text:

\2 \1

0684Q00000ArLBMQA3.png


Forum|alt.badge.img
  • Author
  • 60 replies
  • September 19, 2018

Try the following in a StringReplacer. Text to replace:

(.*)\s*(\(.*\))

Replacement text:

\2 \1

0684Q00000ArLBMQA3.png

Hi @david_r

 

 

I'm getting \2 \1 as a string instead of referring to the capturing groups?

 

0684Q00000ArMgiQAF.png


david_r
Celebrity
  • 8394 replies
  • September 19, 2018

Strange. Which FME version are you running?


Forum|alt.badge.img
  • Author
  • 60 replies
  • September 19, 2018

Beta 2019.0.0.0

 

Mmmm, could that be it? Let me try a different version.

david_r
Celebrity
  • 8394 replies
  • September 19, 2018

Beta 2019.0.0.0

 

Mmmm, could that be it? Let me try a different version.
I did my testing with the very latest FME 2018, for what it's worth.

 

 


Forum|alt.badge.img
  • Author
  • 60 replies
  • September 19, 2018

@david_r

It appears the 2019 beta is the problem!

 

2018 works:


david_r
Celebrity
  • 8394 replies
  • September 19, 2018

@david_r

It appears the 2019 beta is the problem!

 

2018 works:

Fantastic! Sounds like a mail to Safe support is in order...