niall@unipalm.co.uk (Niall Mansfield) (01/07/91)
In most editors which support regular expressions, replace regular expression "^." "" strips off the first character of each line. In Emacs, the effect is dramatically different: it removes everything from your file except the newlines! Any fixes? (I find this is a real problem when writing Emacs lisp programs -- to strip off stuff from the beginning of lines, even when you what's there, is dangerous. E.g. you might think that replace-regexp "^\t\t" "" will safely remove two leading tabs, but it will damage lines which begin with four tabs, six tabs, etc. The messy way out is to use a real newline character instead of the "^" metacharacter, as in replace-regexp "\n\t\t" "\n" but then you need special-casing to handle the first line of the file). [ *** Please reply direct -- I'm not on the list. ***] Regards, Niall -------------------------------------------------------------------- Unipalm XTech niall@unipalm.co.uk 145 St. Neots Road tel: +44 954 211 797 or Hardwick fax: +44 954 211 244 niall@unipalm.uucp Cambridge CB3 7QJ England