in reply to Re: using a regex to determine if a string is the start of the FILE
in thread using a regex to determine if a string is the start of the FILE

Will this still work bearing in mind that the file isn't slurped or binmoded so the line with the "99"..... will always be at the start of the line ie no preceding chars to look back at?
  • Comment on Re^2: using a regex to determine if a string is the start of the FILE

Replies are listed 'Best First'.
Re^3: using a regex to determine if a string is the start of the FILE
by GrandFather (Saint) on Sep 18, 2008 at 19:51 UTC

    Ah, that makes it a little more interesting and experimental. Try:

    /(??{ $. == 1 ? '"99","END"' : '(?=x)(?=X)' })/

    Perl reduces RSI - it saves typing

      Thanks for that. I used:

      /(??{ $. == 1 ? '"99","END"' : 'FOOBAR' })/

      Which also didn't work due to tainting. However, I managed to get the code to be changed, but not in the regex area which might have broken something (it's very old and no test packs), to have

      <code>use re 'eval';<code>

      Which works well, so, thank you all for your time

      John