Get Substring from Input

Hi ,

I have below as Input’s and my requirement is to get outputs as per below. So basically i need the number after the last “-” which is a delimiter. Can anyone help me on this

Example 1:

Input : XYZ-2495682
Output : 2495682

Example 2:

Input : XYZ1 - Appname - 123456
Output: 123456

Thanks

Hi @bharathkumar.yerra

You can use Split Function and Split based on -

For Example 1

Split(InputStr,"-")(1)

For Example2

Split(InputStr,"-")(2)

Regards

a regex approach handling conditional space in a form conform to default regex101 Regex Engine

conditional different handling can be checkec in regexstorm

@bharathkumar.yerra

Use Regex for this as below

image

Hope this may help you

Thanks

@bharathkumar.yerra

Check below for your reference

Hope this may help you

Thanks

Can you please copy paste the Regex here? SO that i can try

(?<=\-|-\ )\d+

@bharathkumar.yerra

Check below the Regex to try

System.Text.RegularExpressions.Regex.Match(sampleString, “(?<=- |-)\d+”)

Hope this may help you

Thanks

Hi

Hope the below expression will help you resolve this

Use a assign activity like this

stroutput = System.Text.RegularExpressions.Regex.Match(Strinput.ToString,”(?<=-)(\d|\s\d).*”).ToString.Trim

Cheers @bharathkumar.yerra

What should be included if:

Example 3:

Input : 123456
Output: 123456

I need one Regex for all 3 examples. Possible?

better is to share all requirements on begin. Give a try on:
grafik

\b\d+\b

1 Like

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