If you are looking for a list of words, then you can use "match global" to find out which of those words occurred in the text. The result of this can be put into a hash table, like I did below using a simple map{} or assigned directly to an array, @matched.

Then use logic to do more complicated AND's and OR's on the subset of the words that matched.

#!/usr/bin/perl -w use strict; my $text = "Mr. X is a bozo and was hired and then resigned."; #build an "OR" regex from a list of search words #add \b (boundary) in front and back, then | between my @search_words = qw(bozo hired resigned); @search_words = map{"\\b$_\\b";}@search_words; my $search_regex = join("|",@search_words); #print "search_regex is: $search_regex\n"; #debug my %matched = map{$_=>1}($text =~ m/$search_regex/gi); #match global print "This bozo resigned - thank goodness!" if ($matched{bozo} and $matched{resigned}); #prints: This bozo resigned - thank goodness!
Now having said that, perhaps we are answering the wrong question here? The SEC has the EDGAR (Electronic Data Gathering, Analysis, and Retrieval system) online. If you look here, main SEC filing forms site and look at EDGAR Searches, there is a button to do advanced boolean searches.The 10-K filings etc are in EDGAR, but I think there is some stuff that is missing - you would have to look. Perhaps, what you need is an LWP program that uses the EDGAR website? I don't know - just an idea.

In reply to Re: What is being matched? by Marshall
in thread What is being matched? by eversuhoshin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.