|Problems? Is your data what you think it is?|
Re: Not getting proper output valueby pryrt (Monsignor)
|on Apr 05, 2021 at 17:42 UTC||Need Help??|
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.