Needs last three digit after : (semicolon)

Hi, I want always the last three-digit after semicolon.

As my input come like

102-311: Apple
192-321: peas
712: Samsung
817: nokia

Expected I want to exxract alwasy last 3 digit before : (semicolon)

I want to extract like 311, 321, 712 and 817 only this.

@Palaniyappan @HareeshMR

1 Like

Fine use this expression in the assign activity like this
if
input is
str_input = β€œ102-311: Apple”
then

str_output = System.Text.RegularExpressions.Regex.Match(str_input,β€œ\d*:”).tosting.Replace(β€œ:”,β€œβ€)
it worked as well (we are replacing : with Replace method)
image

Cheers @balkishan

1 Like

Use regular expression - regex.

Go to https://regex101.com/ to learn how to make such regex.

Cheers

I have to eleminate : also.

I need only last three digit bro
image

This will do the trick:

\d{3}(?=:)

Cheers

can you tell me what it this error.
@Palaniyappan

1 Like

Correct name of the namespace is
System.Text.RegularExpressions

Why don’t you check using IntelliSense?

Cheers

you were almost done buddy

System.Text.RegularExpressions.Regex.Match(str_input,β€œ\d*:”).tosting.Replace(β€œ:”,β€œβ€)

typo mistake
Cheers @balkishan

1 Like

@balkishan

Use below code in assign activity or message box

System.Text.RegularExpressions.Regex.Match(str_input,β€œ\d{3}(?=:)”).tostring

2 Likes

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