I want to extract data a text file using string operation. Please help me.
The data present in the text file is shown as below
aa || welcome to the world
bb || Hello World
I want to extract the values after the delimiter ie., welcome to the world,Hello World , Hi and so on.
Please help me
MyText is the variable holding your data, you can get the matches by assigning a variable
MyMatches of type
MatchCollection with the following expression:
System.Text.RegularExpressions.Regex.Matches(MyText, "(?<=\|\|\s).*") .
Then you can iterate over the matches and get the results in a For Each loop. If
MyMatch is one element in the match collection, you get the data with
im using for each and getting the value as aa || welcome to the world , but i want only the value of welcome to the world . How can i do that. Please help
Oh, in that case, you can get the value with
System.Text.RegularExpressions.Regex.Match(MyText, "(?<=\|\|\s).*").Value. That expression will only get the single match and immediately return the value in your loop.