pabloflinstone pabloflinstone - 25 days ago 7
C# Question

How i can get the first match in regex and import this match in a string?

For example using a regex expression del(.*?)del get delcatdel
and save the result in string or in text

word1word2delcatdelword3word4deldogdelword5

in my text (or string) i need obtain delcatdel

USING c sharp

please anybody help me

Answer
var regex = new Regex("del(.*?)del");
var match = regex.Match("word1word2delcatdelword3word4deldogdelword5");
string matched = match.Value;