in reply to High bit bug in RE?

That should be \0322. The leading zero makes it an octal number. \322 matches a previously captured match.

Update: Hmmm... I dropped the ball on regex numbers. This seems to do what you want:

$ perl -w -e '$_="Hello there\n"; s/t/\322/; print; s/^.*\322/yes/; pr +int' Hello ̉here yeshere
The minimalizing '?' seems to be the problem. Enclosing (.*?) in parens also works.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: High bit bug in RE?
by tommyw (Hermit) on Sep 14, 2001 at 13:16 UTC
    I'm afraid that that doesn't make any difference; neither does using \xD2 instead. There's a section in the perlre documentation which implies \322 only means a previously captured match if I've got 322 brackets (although I'm possibly misreading it).
    Further, using  $a=chr(210); s/.*?$a/yes/; doesn't work either.
    However, all the problems go away if I use \177 (ie. 127 decimal) or lower. So there's a definate inconsistency. :-(
      I'm trying to fix this right now. As for why putting the .*? in parens worked, that's because of a failure to optimize that I've now fixed.

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;