I am working through some Perl code in Track Tracker 4.0 and have encountered an error when the request request message is interrupted. I'm new to Perl, I have done some work with regular expressions, but I have some problems with this, even after reading quite a bit.
I narrowed my problem down to this line of code:
$content =~ s/\n-- \n.*?$//s
I do not quite understand what he is doing, and would like a more detailed explanation.
I understand that s/ / matches the pattern \n-- \n.*?$ And does not replace it with anything.
I do not understand what does .*?$ . Here is my basic understanding:
. - any character except \ n* - 0 or more times of the previous character? - 0 or 1 time of the previous character$ is the end of the line
Then, as I understand it, the final s does . match newlines
So, roughly speaking, we replace any text starting with \n-- \n - this line of code causes some dubious behavior that I would like to understand if someone can explain what is happening here.
Can someone explain what this line is doing? Is it just deleting all the text after the first \n-- \n or is there anything else?
Long term part / real problem (you do not need to read this to answer the question)
My specific problem is that it cuts the quoted content of the signature.
So if email A from the client says:
What happens with an ABCD order?
- Some customers
Staff response says (note the loss of customer signatures)
Shipping today
What happens with an ABCD order?
Customer is responsible
I did not understand, he did not send !!!
- Some customers
Shipping today
What happens with an ABCD order?
When we reply, their message will be clipped to -, which kills the entire context.
It is shipped today, tracking number 12345
I did not understand, he did not send !!!
And it leads to more work, explaining what kind of order, etc.