in reply to Regexp: Only tr second occurance

Your question isn't clear at all. tr changes or deletes characters. Not character pairs, or longer sequences. \w doesn't have a special meaning in tr (unlike with regexes).

Could you describe what you want?

Abigail

Replies are listed 'Best First'.
Re: Re: Regexp: Only tr second occurance
by Evyn (Novice) on Jan 02, 2004 at 12:11 UTC
    I want to delete the second occurance of the string ".0" in a string.
      There are several ways of doing that. One is:
      {my $i = 0; s/(\.0)/++ $i == 2 ? "" : $1/eg; }

      Abigail