[PLUG-TALK] Emacs Regex Replace Phrase

Russell Senior seniorr at aracnet.com
Sun Sep 12 07:23:47 UTC 2010


>>>>> "Rich" == Rich Shepard <rshepard at appl-ecosys.com> writes:

Rich>    A series of numbers were converted in a spreadsheet to text,
Rich> but display (and expert) with a leading "=". I want to use the
Rich> emacs regex search-and-replace to change, for example =89509 to
Rich> "89509".

Rich>    The search string, =.[0-9], highlights on the first two
Rich> digits, and I cannot get the replacement string correct, either.

Rich>    A clue stick is appreciated.

First of all, why the '.'?  That isn't in your example string.

Secondly:

  M-x describe-function 
  Describe function (default describe-function): replace-regexp

That has some documentation of the function you want.

Lastly, to hand it to you on a platter:

  M-x replace-regex 
  Replace regexp =\([0-9]\) with: \1

Even easier, if there aren't '=' characters elsewhere that you want to
keep, maybe just:

  M-x replace-string
  Replace string = with: 


-- 
Russell Senior         ``I have nine fingers; you have ten.''
seniorr at aracnet.com



More information about the PLUG-talk mailing list