MatchCollection matches = Regex.Matches( text, @"([-]+\d{24}) (?<Content>.*?) (?=\1)", RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline ); foreach ( Match match in matches ) { Console.WriteLine( string.Format( "match: {0}\n\n", match.Groups[ "Content" ].Value ) ); }
Update:. This expression will find all matches that occur between two occurrences of a number. If the number should be specific, and not any 24-digit number, change "\ d {24}" to the number you want to match.
Jeff hillman
source share