I want regex expresion for bellow

I get input files name like bellow mentioned format. Use regex expression i want output

Input - EA-0000816860.CALC Final 2
EA-0001527697.CALC Final

Output -EA-0000816860
EA-0001527697

Thanks,
Karthik

@Karthik_Murugesan
Take this in an assign ==> System.text.RegularExpressions.Regex.Match(YourInputString,β€œ\w{1,}[-]\d{1,}”).Value.ToString

And for Multiple matches you can take==>System.text.RegularExpressions.Regex.Matches(YourInputString,β€œ\w{1,}[-]\d{1,}”)

you will get your output in RegEx Match collection

There are two methods to get this

Using Regex

Str_output = System.Text.RegularExpressions.Regex.Matches(str_input.ToString, β€œ.*(?=\.)”)(0).ToString

using split method

In assign activity
Str_output = Split(str_input.ToString, β€œ.”c)(0).ToString

Cheers @Karthik_Murugesan

1 Like

@Karthik_Murugesan

If structure is same the try the below

System.Text.RegularExpressions.Regex.Match(str,"EA-\d+").Value

Here str is the variable containing the data

EA-\d+

Cheers

1 Like

System.Text.RegularExpressions.Regex.Match(β€œyourText”,β€œ\w{2}-\d+”). Value

@Karthik_Murugesan