[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Regexp replacement question

From: Yuri Khan
Subject: Re: Regexp replacement question
Date: Thu, 23 Apr 2015 21:05:15 +0600

On Thu, Apr 23, 2015 at 3:54 PM, MBR <address@hidden> wrote:

> But what do I do if I want to replace leading zeroes with the same number of
> spaces.  E.G. if my file contains:
> Ideas?

Idea #1: You can repeatedly replace ^\(_*\)0 with \1_ until saturation.

Idea #2, if you deem that inelegant: You can use the “replace with
expression” form.

Query replace regexp: ^\(0+\)
Query replace regexp ^\(0+\) with: \,(make-string (length \1) ?_)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]