I had help creating a regex to get data out of some text documents (please don't comment about parsing html with regex - the resources aren't really html). The regex I have that works for 90% of the documents is:
($match{PAGE}, $match{DESC}) = $text =~ /\[Pages? ([\d-]+).*\n\n(.*?)\n\nAGENCY/s;However, a few documents don't have an 'AGENCY' section. For instance <link>http://www.gpo.gov/fdsys/pkg/FR-2012-02-03/html/2012-2363.htm</link> fails this regex match for this reason. What I want from this document is:
Commercial Leasing for Wind Power Development on the Outer Continental Shelf (OCS) Offshore Virginia--Call for Information and Nominations
I can't depend on \\.*\\n+ - there isn't always a 'Docket' or other number above. I've tried:
/\[Pages? ([\d-]+).*\n\n(.*?)\n\n(?:AGENCY|ACTION)/s
/\[Pages? ([\d-]+).*\n\n(.*?)\n\n[A-Z]:/s
I've tried splitting this up into two regexes and so on. For more examples: <link>http://www.gpo.gov/fdsys/browse/collection.action?collectionCode=FR</link>. Also, I'm not adverse to different ideas to get the data I want than searching for the section that comes after the paragraph that I'm interested in.
In reply to regex help by ag4ve
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |