in reply to pattern matching
You have two errors.
"." doesn't match newlines. Use the "s" regexp modifier.
The second problem is that the regexp will ever only return one match. It will start matching at the first "<!-- Start_of_revision-->" and will continue until the last <!-- End_of_revision-->. Append a question mark to ".*" to make it non-greedy.
@revision_array=(); if (m/<!-- Start_of_revision-->(.*?)<!-- End_of_revision-->/sg) { push (@revision_array, $1); }
The following snippet does the same thing, but it should be faster (at the cost of using more memory):
@revision_array = m/<!-- Start_of_revision-->(.*?)<!-- End_of_revision-->/sg;
By the way, I removed the "m" regexp modifier since it's useless for regexps which use neither "^" nor "$".
|
|---|