Extraction of Number from String in the web browser

Dear Community,

May i know how can i extract the following number from string (obtained from web browser)?
Data

  1. Attachment 12
  2. Record23

Result wanted

  1. 12
    2.23

I saw there are some post in Uipath regarding this topic but i not really sure what tools and what formula we can use. Is it that we must use for each tool at the end of the workflow in this case?

Appreciate if you can briefly explain on what are the tools and formula can use in this case.

Thank you.

Hi

We can try with Regex on this
System.Text.RegularExpressions.Matches(inputstring,“[0-9]+(.[0-9]+)|\d+”)

Once you got the output in a datatable use a FOR EACH ROW activity and pass the above datatable as input

—inside the loop use a assign activity like this
currentrow(“yourcolumnname”) = System.Text.RegularExpressions.Match(Currentrow(“yourcolumnname”).ToString,“[0-9]+(.[0-9]+)”).ToString.Trim

Cheers @SH_94

grafik

We assume the expected output was combined with the numbered list numbers and are not to match

Hi @Palaniyappan ,

Sorry that maybe the post for result wanted a bit confusing and below is the result that i wanted:

First Data: Attachment 12
Second Data : Record23

First Result wanted : 12
Second Result wanted : 23

Will the previous formula work in this case?

Thank you.

1 Like

Hi @ppr ,

May i know what tools u are using ? Can u provide the screenshot ?

Thank you.

for prototyping we are using online tools

then we incorporate it in our implementation

Also have a look here:

Ofcourse it will
And it will work for both whole and decimal values

Pls give a try and let know for any clarification

Cheers @SH_94

Hi @Palaniyappan ,

Noted on this. May i know what we need to do if we didn’t use the for each row tool?Reason being is the data extract is just one sentence from the web browser and it does not contribute the datatable.

If i plan to use assign activity in this case. Could you guide me on this?

Thank you.

1 Like

Fine if the input is in string variable named in_string

Then use this expression in a assign activity

Str_output = System.Text.RegularExpressions.Regex.Replace(in_string,”[^0-9.]”,””).ToString

Cheers @SH_94

is this working @SH_94

Hi @Palaniyappan ,

It works and many thanks for your clear explanation

1 Like

Hi @Palaniyappan ,

May i know how can we convert it to number in this case? Because it seem like it is in string format.
image.

Thank you.

May I know what is the datatype of output attachment

Try with outputattachment.Count>0
@SH_94

1 Like

Hi @Palaniyappan ,

many thanks and i able to solve it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.