How to split the equation(string type),if A1-A2 then var1=A1, var2=- , var3=A2

Hello smart users
I have three excel files as shown in the pic. I like to split the column of equation in Master file, like this
11110004+11110005-11110002 = Str_VarEquation
Var1= 11110004
Var2= +
Var3= 11110005
Var4= -
Var5= 11110002
Sometimes the equation is has only + like 11110001+11110002
How to split those equations
I am implementing the calculated result in my logic as shown in the pic of
the green area (30,330,140)
Thanks in advance

Hi @eimon

Use this regex pattern (use matches activity) it will only only extract numbers and store it in collection. \d*

1 Like

You can use this

1 Like

@Eric_Wong_Test Thank you
But sometime the no has 5 or 6 digit too like 111001 or 11101 .

Have you tried my pattern

It will extract all the numbers

1 Like

1 Like

@prasath_S Dear, Honestly i am working on “matches” activity ,but my first time using it and google it for how to declare on the Configure regular expression then lasting time on it. here are the updates :shushing_face:

I think It should’nt be exactly 1 and should be like all in quantifiers

Or

You can select advanced and type the regex I gave

1 Like


In the For Each, Properties TypeArgument should change to System.Text.RegularExpressions.Match

1 Like

@prasath_S Hello i got this result. But how to get the +/- sign .thank you for the previous answer.スクリーンショット (327) スクリーンショット (328) スクリーンショット (329)

Here is my solution,
This is the input let’s assume 11110004+11110005-11110002

1.first we split it using regex in for each.
2.in for each body first we get 11110004 so find corresponding value for this number (i.e) 60 as per your input.
3. Replace the original string (i.e) replace 11110004 with 60 using string.replace(youroldstring,newstring)
4.do similar to other numbers also in for each body.

In this ways instead of old values you get nee values with + and - in it

1 Like

Dear @Eric_Wong_Test would you mind sending this file? because i dont get the same result like you . may be i was wrong setting in the Configure Regular expression. First , match is systems.collections.Generic.IEnumberable in Match activity and in for each loop Properties TypeArgument changed to System.Text.RegularExpressions.Match as you said

thank you

It should be a back slash \ (not a regular slash /). You can simplify the regex to:

\d+|\+|\-

image

1 Like

Is [0-9]

1 Like

Hello @Eric_Wong_Test @ptrobot Thanks for the point. when i type “” in RPA , it appears as “¥”.

Ok, that’s strange. If you copy and paste my regex from previous post, do you still get the weird character?

image

1 Like

match.xaml (6.0 KB)

1 Like

Also, I think you are using Japan Keyboard, so you can’t be the \

1 Like

yes eric @Eric_Wong_Test i am using jp keyboard. i found out my mistakes , i put the space after “(” it . thank you.

@ptrobot it just ok now. cause my keyboard is jp . thank you.

1 Like