Hi Robert, > > My goal was to chop a final backslash it was immediately preceded > > by another backslash. > > Ok, then my suggestion was not a solution to your problem. Au contraire ... that's my feeble at French, a language I can't speak :-) I think your suggestion *was* essentially a solution to my problem. It merely need the tweak I mentioned, as follows. > > So I'll use: > > > > s.chop! if /\\\\$/ =~ s > > Personally I would not use chop! since it is rather meant to remove record > separators (similar to chomp! but not as sophisticated, see here: > http://www.ruby-doc.org/docs/rdoc/1.9/classes/String.html#M001293 As I read it (in the section entitled "str.chop => new_str"), the web page your referenced indicates that chop is intended to remove *any* last character; it merely has special semantics for record separators to transcend the divergence of Windows from Unix. > In your case I'd prefer > > s.sub!( /\\\\\z/, '\\' ) I assume "z" is a typo for "$" and I further assume that using pattern matching is much less efficient than directly "chopping" (though the difference is imperceptible for the amount of data usually processed by scripting languages.) I apologize for belaboring this point. Again, I'm in your debt for your thoughtful responses. Best wishes, Richard --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.713 / Virus Database: 469 - Release Date: 7/8/2004