in reply to Re: Regex trouble w/ embedded 0s?
in thread Regex trouble w/ embedded 0s?

If you wanted to grab the first 36 chars from the start of a string, then grab the first subsequent group that was terminated by (and did not contain) a  \0\0\0 sequence, what regex would you use?

Replies are listed 'Best First'.
Re^3: Regex trouble w/ embedded 0s?
by choroba (Cardinal) on Jul 11, 2014 at 12:40 UTC
    I dunno, prolly
    /^.{36,}?\0\0\0/
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      But that doesn't differentiate between the first 36 chars and the subsequent whatsit, and includes the \0\0\0, and needs the use of  $& or a substr operation to access what was matched. My guess (supported by roboticus's later post) was that the chunks were wanted separately, sans terminator. Given that assumption, the regex didn't seem so strange. But there are many paths...

Re^3: Regex trouble w/ embedded 0s?
by Laurent_R (Canon) on Jul 11, 2014 at 17:38 UTC
    If you wanted to grab the first 36 chars from the start of a string, then grab the first subsequent group that was terminated by (and did not contain) a \0\0\0 sequence, what regex would you use?
    Yes, AnomalousMonk, you are right, if I wanted to do that, I would probably use a regex very similar to what roboticus used. I was really wondering why he wanted to do something a bit strange like that, and he has not provided an answer which explains it all.