I am trying to come up with the right regex (compatible with python) that would match a file that contained sample input as follows:
On the third day of Christmas
my true love sent to me:
three worms a eating
two garlic cloves
and a koala in a bamboo spree
This is just ONE possibility. The important part is that the first line have "On the X day of Christmas" with no wrong capitalization (like ChrISTmas).
That should be something like
\^On the [first|second|third|fourth]...
all the way up to twelfth. Same thing with the ending, last line just needs to have 'and a ...'
$and a *\ (?)
But how can I check with regex that each line of the file is in the correct order?
For example, 'two garlic...' before 'three worms' is NOT correct
On the third day of Christmas
my true love sent to me:
two garlic cloves #SWITCHED
three worms a eating
and a koala in a bamboo spree
Similarly, it can't jump bits. If it starts with 'five X', the next line needs to be 'four Y', 'three', 'two', etc.
On the third day of Christmas
my true love sent to me:
five cats a dancing #Goes from 'five cats' to 'two garlic', not ok
two garlic cloves
and a koala in a bamboo spree
Here are some attempts at matching multi-line regex I came up with, but to no avail. http://www.codeshare.io/jLI9l
Here's another one where I removed the file-input and tried something else: http://www.codeshare.io/u4E7t
I want it to be able to match and print 'correct' if the input file structure/match is correct
diff
the results. ss64.com/bash/diff.html Note the example at the very bottom.