Hi Monks,

Regular expressions are simply the most wonderful thing on the planet. Problem is that the regular user out on the tubes don't understand what \w, \b, let alone .+ means. What most of them do understand is how to pop stuff into Google and get some sort of a response.

They've got the + and - operators, which are good, using AND and OR, etc. so your basic boolean logic, which is very user friendly, and quite effective.

So how do I convert those arbitrary search parameters into regular expressions? I'll start coding something that will split on the AND and OR, and start massaging a regular expression with pipes and brackets, and I may end up with something that may or may not work very close to how Google would parse their inputs.

Any thoughts from your side? CPAN did not reveal any obvious module that could do this for me. I'll see how it goes, and share the code for public scrutiny when I'm done.

Thank you kind monks, have a blessed day of Perl Mediation.

Hail Larry...

Massyn


In reply to Convert "google" to regex? by Massyn

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.