I have a text file with so many lines. From the entire text file I need to extract all the repeated strings in the file after specific string. Let’s say Input is a text file with so much content
Animal.Name=“Forest Elephant_1” <Has it’s own power.>
Output should be:
Tiger
Forest Elephant
African Bush Elephant
@Gokul001 It is throwing an error saying “End of Expression Expected”. I passed the expression into pattern property “Matches activity”. Provided input variable and output variable. I am very new to regular expressions concept. Correct me if I did wrong.
There is small mistakes in your method of writing that code, actually Matches returns collection not a single value, so code to be used is
data = System.Text.RegularExpressions.Regex.Matches(input_string,“(?<=Animal.Name=.).*(?=_\d+)”).Cast(Of Match).Select(Function(m) m.Value.ToString).ToArray()
@NIVED_NAMBIAR Hey it worked. Thanks a lot but I didn’t understand the functionality behind the code. The code seems to be a bit advanced to me. Can you suggest any links to understand how functions work?