I am having some problems with pattern matching.
I need to generate some perl that searches through an html document to find snippets of text delimited by two strings, and to assign anything between these two delimiting strings to an array.
The snippets of text are spread over 4 lines.
The opening delimiter is <!-- Start_of_revision--> on the first line, and the closing delimiter is <!-- End_of_revision-->, on the fourth line.
There can multiple instances of this 4-line snippet in an html document, and each time I detect one of these instances, I would like to put anything between the delimiters into an array, thus building up a list of revisions.
I have tried:
@revision_array=(); if (m/<!-- Start_of_revision-->(.+)<!-- End_of_revision-->/mg) { push (@revision_array, $1); }
But alas, nothing is detected. I'm guessing this is a hopelessly naive approach, but I really haven't got the time to work it out myself, so I was wondering if you guys could help me out?
C J
In reply to pattern matching by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |