You could probably extract certain key words that you specify, no matter where they appear, but other than that, I don't think you would be able to do what you are asking for, especially when it's an ad you're parsing, which would be in ad-english rather than proper english. It wouldn't be good enough to use:
my @capture = $str =~ /(rabbits|dogs|\d+-\d+)/g;
if the form might change. You would have to make it case insensitive, allow for non-digits and hyphens and parenthesis in the phone number, etc. I don't know what the one-line foreclosure ads tend to look like, but I guess you could have prices that look like telephone numbers (without a $) and encounter other problems.
Maybe you could find some less complete solution, such as identifying when an ad contains a single string of numbers (with possible commas or periods in the proper places) that's preceded by a dollar sign. If you were hoping for some kind of "search-by" feature, maybe you better make it for prices in that format only.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.