pabloflinstone pabloflinstone - 11 months ago 74
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


in my text (or string) i need obtain delcatdel

USING c sharp

please anybody help me

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