RegEx for Text File

Hey All,
I am using a txt file with 5 lakh records where in i need to extract desired string from each row.
have stored text file in Match Collection and using for each row to iterate as below :

Input Eg : 1168~abcd~null~3~1~0~2009-10-27 05:00:00~2009-10-27 05:00:00~2021-06-16 10:13:35~2009-10-27 05:00:00~2009-10-28 01:13:34~

Desired Output : Need to extract 1st value before ~ and storing in str_SerialNo variable=1168


are you facing any issue with it?

Can you please elaborate the issue

You can use item.Value.Split("~"c).First

Assuming matchcollection is a collection of match and not strings

Can you please let us know what is there is match collection if this does not work


Hi @prerna.gupta

You can use the below regular expressions.


Hope it helps!!


The expression u r using is already correct
May I know what issue u r facing

This is similar to item.ToString.Split("~"c)(0) and it extract only 1st numeric digit before ~ ie 8 instead of 1168
For each - list of match collection only

HI @prerna.gupta


strinput = “1168~abcd~null~3~1~0~2009-10-27 05:00:00~2009-10-27 05:00:00~2021-06-16 10:13:35~2009-10-27 05:00:00~2009-10-28 01:13:34~”

you can try this

item is of match collection type.
Suggested is throwing error MatchCollection cannot be converted to String

Okay @prerna.gupta Use the below one


Hope you understand!!

you can change the variable type to matchcollection

then it will work



Can you please use a log message and show what is there is each item…please log the item…looks like the matchcollection itslef is missing 116 in it


I need to extract multiple values from Input String due to which not using RemoveEmptyEntreis function

To be precise i need to extract 2 values
Value 1 = Anything before 1st ~ symbol = 1168
Value 2 = Anything after 1st ~ symbol = abcd (this is working good using item.ToString.Split("~"c)(1))

Issue Facing - Getting only 1st numeric digit before ~
Output = 8
Desired Output = 1168

HI @prerna.gupta
1.Value 1 = Anything before 1st ~ symbol = 1168


2.Value 2 = Anything after 1st ~ symbol = abcd

let me know its working or not for you

Multiple Errors


I’m sharing the xaml you can follow same as it is

Xaml : - RegEx for Text (1.9 KB)


Sure let me try. Thanks

if not you can try this screenshots

you can see the out


Dependencies errors

can you share the screenshots of your flow