Skip to main content

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=)+)",""),"(+;](.)*)","")

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.


Hi Mario,

Is your need in Nintex Forms or Nintex Workflows?


It is a form.


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

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


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!


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=)+",""),"((;](.)*)","")


Works like a charme. Thanks!


Reply