As well, as you've posted on this issue before, it's generally considered good form to keep it in a thread or at least cite your previous postings on the issue (I'm guessing Search for Second Occurence of Substing and get containing text and Searching string for paragraph..).
For your actual question, your specification leaves something to be desired. I will read it as "Extract all text following '===Comments===' until the next '=' or end of file and then extract all text following '=Aditional Notes=' until the next '=' or end of file". Note the misspelling of Aditional<sic>. The following will take your posted material and capture the strings in question into arrays. If this does not work for your actual text, post that case so we can have accurate input for test cases.
#!/usr/bin/perl use strict; use warnings; my $text = do { local $/; #slurp <DATA>; }; my @comments = $text =~ /(?<====Comments===).*?(?==|$)/gs; my @additional = $text =~ /(?<==Aditional Notes=).*?(?==|$)/gs; 1; __DATA__ ===Comments=== This webpage contains information bla bla bla =Section 2= Some more text here. ===Comments=== Some other comments here. =Another section= =Aditional Notes= More notes here.
In reply to Re: Extracting Text Using Regular Expressions Problem
by kennethk
in thread Extracting Text Using Regular Expressions Problem
by danj35
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |