Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I personally believe that we may have different interpretations of the "real life" expression: for example, in real life a problem I've often had to face is that of dating with girls. In this respect, none of the "Perl-specific" regex features ever helped me, and neither did [Pp ]erl as a whole although I can imagine some convoluted and highly improbable situations in which they would. Now, due to my severe health conditions, I am coping with intense pains and precisely, in the very instants I'm writing this, especially at my left leg: (to the point that it's very hard to write at all,) needless to say, those things do not help in any way either.

So, my point is that there is not such a thing as a "real life" IT/CS problem, which appears to be what you're referring to. There are actual problems, period. And there's that Turing thingie which I'm not repeating here, which states that if your programming language is powerful enough, then it will be equally able as any other one to solve them. Then there are tools, and there are tools which are similar to others, but slightly more or slightly less powerful than those others. Thus you may have a situation in which some particular Perl's enhanced regex feature would not be "indispensable" but the absence of which would make your regex say ten time longer and several times more error prone: how indispensable would that feature be for you?

To only take into account the simplest of examples, since you talk about non-greedy matching, see my recent Insane (?) Regexp-based jpeg (JFIF) extractor... which uses the extremely simple /(\xFF\xD8 .*? \xFF\xD9)/xsg regex: how would you have done that without non-greedy matching? Please note that however ridiculous, the problem I was trying to solve with that program was a real world one in your sense, namely that of "extracting those images from that file ASAP."

On to the future: one oft repeated mantra at the Monastery and elsewhere is that regexen are not well suited to parse HTML and XML, which is perfectly true. But under Perl 6 they will be so enhanced as to be promoted to "rules" which in turn, it is said, will be perfectly apt at implementing real parsers (although I'm not an expert, and not even a beginner, in parsing theory and I don't know which kind of parsers...) Ain't this a real-life problem?

If you can't understand the incipit, then please check the IPB Campaign.

In reply to Re: Perl regex in real life by blazar
in thread Perl regex in real life by RezaRob

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (8)
    As of 2019-08-20 09:42 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found