in reply to Regex to find the last matching set in a long scalar

I can see how to make the expression non-greedy, which would make it possible to capture only the first set
OK, so just reverse the string, find the first set, and reverse it back.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re: Regex to find the last matching set in a long scalar

Replies are listed 'Best First'.
Re^2: Regex to find the last matching set in a long scalar
by superwombat (Acolyte) on Nov 15, 2014 at 08:44 UTC

    Maybe. I don't know how to reverse a scalar. I could convert it to an array and reverse that, which is my current (slow) method. My end goal is to avoid having to manipulate this giant scalar as much as possible, and I was hoping with with the proper regex I could extract the data I want with as little handling of the large file as possible.

    Sadly, because of the way I'm retrieving this file I can't just read it from the filehandle, it has to be a single scalar, so elegant solutions like File::ReadBackwards don't work in my case either.

      choroba linked to the reverse function. Maybe you want to read the link?

        My apologies. I clicked on the link after I replied, and then I felt very stupid :-(