Substring middle values

Hi Team,

I have a single line say
01 12/12/2000 12345 Today is Monday 123.00- Test
01 12/12/2000 12345 Today is Monday 123.00- Test
01 12/12/2000 12345 Today is Monday 123.00- Test

I am reading multiple row values like above
I want to read only 12345 and 123.00 from each row and store in a variable
using substring or by other activity, help needed

@prasath17 I think regex would help, what do you think ?

1 Like

@Hiba_B
These can seemed to be work around

@Balan

1 Like

@Hiba_B - Yes, one option would be regex…

@Balan - Please check this…Assuming there will be always - after this number…

Groups(1) - 12345
Groups(2) - 123.00

1 Like

And to complete the answer of @prasath17 and @NIVED_NAMBIAR in another way an artisanal option would be split:
value_of_12345 = value_of_row.toString.Split(Cchar(" “))(2)
value_of_123.0 = value_of_row.toString.Split(Cchar(” "))(6)

Happy automation :grinning_face_with_smiling_eyes:

2 Likes

yes @Hiba_B
Substring is also a good option in this case

1 Like

@Balan - Another Option…

1 Like

This regex works for fetching 123.00 ?
Because the text length before that will change - Today is Monday
this can be changed to Today is an auspicious day or any thing else single word
5 words also.
Is it possible to extract reading this 123.00 from end of the line ?
Number length may change

Try this

Tried like below any changes to be done, not worked on this.
System.Text.RegularExpressions([\d. ]+(?=- \w+)
Identifier expected

System.Text.RegularExpressions.Regex.Match(input_string,"[\d. ]+(?=- \w+)").Value.ToString

input_string is the string which u are comparing

I tried with input like this but it returned blank. Anything needs to be changed in code ?
s CES STD 12345678 RPA DENTAL EQUI 03APR 430.00- 40 P
Ouput should be 430.00

SEEMS like regex need to be bit modified
System.Text.RegularExpressions.Regex.Match(“s CES STD 12345678 RPA DENTAL EQUI 03APR 430.00- 40 P”,"[\d.]+(?=-)").Value.ToString
it is working

Yes almost perfect. Sorry i missed one
Actual Output is 430.00
Expected is 430.00-
Need the minus symbol also, Is it possible to fetch that also ?

Please check this…

System.Text.RegularExpressions.Regex.Match(“s CES STD 12345678 RPA DENTAL EQUI 03APR 430.00- 40 P”,"[\d.]+-").Value.ToString
1 Like

Perfect… thanks Nived and Prasanth

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