Establish regular expression
-
Hello, such a problem, it is necessary to write a regular expression that would give everything that is between the words =begin and =end. If the case is - =begin ... =end ... =end, then only that goes back to the first =end. I wrote it myself, "=begin(.*)=end, but it only works when the text fits in one line.
-
using System.Text.RegularExpressions; // ... var str = "=begin 1 =end 2 =end"; var m = Regex.Match(str, "=begin(.+?)=end", RegexOptions.Singleline); m.Groups[1].Value // " 1 "