Hi, At first I want to thanks all monks who took care about broken Temple yesterday. We discuss about this my question in Chatterbox, but due bug in interface I wasn't able to add question to SOPW. So I am doing it now.

Question is simple. I have something like:

((AND|OR)([!=><]+)(.*))+

(I used regex just to describe how my string can look like) I fact this can be something like:

$check = "AND=>1536463OR<foobarOR=5";

I need this to parse into $1, $2, $3, $4...... so:

while ( $check =~ /^((AND|OR)([!=><]+)((?:(?!AND)(?!OR ).)*))/ ) { $1...; $2...; $3...; ...; $check =~ s/$1//; }

(this was made with help from other monks...) but unfortunately don't work well in all cases. What I need is parse string into logic operator AND or OR, =<>!(should be its combination) and last - variable. If you have any suppose how to do this, please get me know. At least syntax of the string can be changed.....

Thanks for help

Li Tin O've Weedle
mad Tsort's philosopher

Edit: chipmunk 2001-09-03


In reply to Parsing with regex by LiTinOveWeedle

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.