in reply to Alternatives for index() ... substr() ?
Thank you for all the suggestions! This place never disappoints!
Since my seemingly unclear naming of the variables has come up a few times, I'll explain this a bit: the variables that are only used for 'calculating' have a short name, because they are only 'tools', not a part of the end result. For example my $sl is short for 'source length' - the length of the string that will be called my $source later on. Other example: my $de is short for 'destination end' - the index of the last character of what will become my $destination.
I feel a little bit silly because in a way, I already use the method that I was looking for (my $text = /blabla/), but I did not know I could actually fetch strings in a way that is understandable to me. I have done some searching before posting this, but all I found about this method is stuff that looks like /"(?>(?:(?>[^"\\]+)|\\.)*)"/. I am truly sorry about my noobieness, but when I see something like that, I can't help but think "What the hell am I staring at?"
On the other hand...
$text =~ /copying(.*)from/ or die "Couldn't find the pattern"; my $msg = $1;
... as suggested by Eily, this I understand and will be testing what I can do with it.
And finally, is it... is it worth trying Parse::RecDescent? Have gone through it and it looks like it might take some time to get my head around it, I do have some time, but I don't like spending time on something just to see it does not help at all. Have read through the thread linked by LanX and I can't help feeling a bit suspicious about the suggestion.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Alternatives for index() ... substr() ?
by Eily (Monsignor) on Nov 24, 2017 at 10:48 UTC | |
|
Re^2: Alternatives for index() ... substr() ?
by hippo (Archbishop) on Nov 24, 2017 at 10:49 UTC |