First parse the text to a list with something like this
private function parseText(text:String):Array<String>
{
var dialog:Array<String>=new Array();
var lines:Array = text.split("\n");// split in all lines
var line:String;
while (lines.length>0)
{
line= lines.shift().replace("\r", "");// remove more hidden info...
if (line.length != 0)
{
//you can create a switch if you are not just adding dialogues
// just add if(line.indexOf("Dialogue")!=-1)
dialog.push(line);
}
}
}
After that it's easier to work with each line. If you want to use codes for example Dialogue01 is better to add another char like : or _ at the end of the word to identify key words. Use the split(":") function to separate the parts. That way you can separate a line with your char. In the right side you get your line and on the left side you get your keyword "Dialogue" and the rest can be parsed as a number. That way you dont have to worry to write Dialogue01: or Dialogue1: or Dialogue1234: