using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^(?!\t)(?:(FULL|SMALL)\W*)?([^\n]+)(.+?)(?=^(?!\t)\w+?|$(?!\n))";
string substitution = @"<div class=""PANEL $1"">\n<div class=""action"">$2</div></div>\n\n";
string input = @"
Gahriel and Diana are standing in the living room.
FULL: The living room has SOFA and a table. On the table have CUPCAKE and a NOTE at the bottom (or somewhere that doesn’t present the first time we see it.) Gahriel is walking to the kitchen calling out his mom.
Gahriel
Make yourself at home!
Diana
okay!
Gahriel
(calling out his mom)
Mom?
Where is she?
SMALL- Diana inside the living room with Gabriel. She’s amazed with the picture on the wall related to his mother and young Gahriel.
Diana ask
Is this you and your mom?
Gahriel (smiling)
Haha, yup.
That’s me.
Diana (yelling and laughing so loud and keep talking)
Diana
Argh.. that’s so cute.
Look at how chubby you are!
";
RegexOptions options = RegexOptions.Multiline | RegexOptions.Singleline;
Regex regex = new Regex(pattern, options);
string result = regex.Replace(input, substitution);
}
}
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