Split string with decimal places

Hi Guys am trying to split the characters with decimal places, but am not getting:

EB*C*IND*30***23*1000.55*****Y here I want to split 1000.55 only, but I cant achieve the same, but am getting value without decimal value. Please help me out how to extract this with decimal values. Thank you for the same.

Regards,
Gokul.

@gokulvasant

if you are looking to extract the value with decimal then use the below regex exp

String Output =System.Text.RegularExpressions.Regex.Match(Input,"\d+\.\d+").ToString

Find workflow below for ref

Example.zip (2.5 KB)

@ushu Thank you for your quick reply, but your solutions only works for decimal values, some times I will get decimal places and some times not. My input may be “EB*C*IND*30***23*1000.55*****Y” or “EB*C*IND*30***23*1000*****Y”

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"[.\d]+(?=\D*$)").Value

Regards,

1 Like

@gokulvasant Can you try the below one

\d{4}(\.\d+)?

1 Like

@Yoichi @ushu both are working fine, thank you for the reply.

@Yoichi @ushu I need one more help on this:

I want to extract this EB*C*IND*30***23*1000*****Y characters from the text file, actually am using following code regex:

(?:EB*C*IND*30***23*\d+.\d+******Y)

Now in this am getting following output only: EB*C*IND*30***23*1000*****Y

In this, also I want to get get decimal places, please help me out.

Thank you.

Hi,

I don’t think it’s correct regex pattern. Does this work?

If you want to extract decimal number:1000, the following will work.

(?<=EB\*C\*IND\*30\*\*\*23\*)[.\d]+(?=\*+Y)

Regards,

1 Like

Thank you @Yoichi

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