This was a very simplified example for what I want to do, but I was sure there was a better way than doing an if() and grabbing parts of the match over and over on $_.

I am keenly interested in your reference to "not using regexp to parse natural language". I am a beginner and have no programming background so my code is all a really ugly hack. A project I was working on is parsing foreclosure ads. You can find them all over the net, but basically you can scrape the ads (which thusfar have been one line per ad) and then then parse out the relevant info like price, dates, plat book, etc. Everything useful/relevant to the sale. There is no good format for these ads, and it appears each attorney does their own thing.. sometimes you have an address, sometimes you have a description of the property. I have a butt-ugly hack that can do it to some degree, but I know it could probably qualify for all time worst code ever written.

Thank you for your help!!

In reply to Re: Re: Another regexp question by carric
in thread Another regexp question by carric

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.