How is this question any different than most of your other recent questions?

The same basic ideas work for most, if not all, of those questions.

Until you understand the solutions that have been freely given to you in those other discussions, you will never be able to solve these problems for yourself.

As you have been told repeatedly, PerlMonks is not a codewriting or personal debug service.

Your specific question was "where is the mistake?". The snarky answer is "It appears there are mistakes on lines 9, 10, and 18, at the very least". More information to make it less snarky: Since you are not getting the output you desire, then you do not appear to have built up a reasonable regex to perform the transformation you desire -- hence, the "mistake" is in the lines that build that regex.

A more helpful response (but I do not claim it's an answer): Can you explain what you thought those three lines of code were doing? And why you thought they would match your input data to create your desired output data? If you cannot explain your thought process, then you need to go back and study regex and perl fundamentals again, using the resources already pointed out to you. If you are able to explain your thought process, then maybe someone here will be able to explain to you what was wrong in your mental algorithm. Because there have been dozens of replies to your previous posts, and you don't seem to be understanding the regex concepts that those solutions have shown you; if that's the case, then having someone give you yet another solution to this specific problem won't actually help you, because you won't be able to fix the problem in your next regex in a few days/weeks/months -- and that is then a waste of your time, let alone the time of those who have tried to help you. You need to put in the effort to learn... and the first step in that effort is to explain why you thought this code would work.

Note: I've never replied to any other of your threads, because I'm not really a regex expert, and lots of other people have given you much better answers than I could. But what I hate seeing in forums like this is when people keep asking the same kind of question without every apparently growing in their understanding -- which either means that the forum regulars haven't found the root cause of why you cannot figure it out yourself, or because the person asking is too lazy to learn on their own. I always desire that any such question is not actually the second circumstance. And assuming that it's the first circumstance for you, I thought I would step in and try to phrase things differently than you've previously seen, so that maybe you would be able to provide insight into your thought processes, and thus the experienced Monks here would be able to help correct your misunderstanding that is preventing you from solving these sorts of problems.


In reply to Re: Not getting proper output value by pryrt
in thread Not getting proper output value by suvendra123

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.