Replace()

  • 12 January 2016
  • 7 replies
  • 5 views

Badge +3

My original question was: “I need the IT-Costcenter from a string e.g. ITCOST=1234567; COST=7654321; ACC=0000. The rest should be replaced with " ". How can i achieve that with replace()? I tried it but i didn't get the desired result.”

 

The solution was replace(replace(costcenter,"(ITCOST=)+",""),"([;](.)*)","") and it worked perfectly (thanks for your help!). Now i have the problem, that I need the second value from the string e.g. ITCOST=1234567; COST=7654321; ACC=0000 for a second field. Could someone help me …again.

 

Thanks for your help! I really appreciate it!

 

 

The solution was: replace(replace(_costcenter,"((.)*(; COST=)+)",""),"([;](.)*)","")


7 replies

Badge +4

Hi Mario,

I would use a Regular Expression action to select this value:

164903_pastedImage_1.png

The following pattern should give the ITCOST value:

(?<=ITCOST=)[0-9]*(?=;)

Let me know if this works for you.

Cheers,

Barry.

Badge +7

Hi Mario,

Is your need in Nintex Forms or Nintex Workflows?

Badge +3

It is a form.

Badge +7

There is probably better syntaxes but this formula should do the job happy.png

replace(replace("ITCOST=1234567; COST=7654321; ACC=0000","(ITCOST=)+",""),"([;](.)*)","")

Badge +3

replace(replace(_costcenter,"ITCOST=1234567; COST=7654321; ACC=0000","(ITCOST=)+",""),"([;](.)*)","")  ---_costcenter is my string variable

The result was ITCOST=)+. The number of the costcenter is not always the same. What I need is more like e.g. COST=[0-9].

Tia!

I really appreciate your help!

Badge +7

In my syntax, "ITCOST=1234567; COST=7654321; ACC=0000" should be replaced by your variable.

 

I think you should use this one :

replace(replace(_costcenter,"(ITCOST=)+",""),"([;](.)*)","")

Badge +3

Works like a charme. Thanks!

Reply