using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<=TITLE)(?!\s*Direct Submission)[\S\s]*?(?=JOURNAL)";
string input = @" TITLE The Identification of Novel Diagnostic Marker Genes for the
Detection of Beer Spoiling Pediococcus damnosus Strains Using the
BlAst Diagnostic Gene findEr
JOURNAL PLoS One 11 (3), e0152747 (2016)
PUBMED 27028007
REMARK Publication Status: Online-Only
REFERENCE 2 (bases 1 to 462)
AUTHORS Behr,J., Geissler,A.J. and Vogel,R.F.
TITLE Direct Submission
JOURNAL Submitted (04-AUG-2015) Technische Mikrobiologie, Technische
TITLE OtherDirect Submission
JOURNAL Submitted (04-AUG-2015) Technische Mikrobiologie, Technische";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx