* query replace regex
@ 2007-02-21 18:58 Gary Wessle
2007-02-21 19:23 ` james
2007-02-21 19:38 ` james
0 siblings, 2 replies; 3+ messages in thread
From: Gary Wessle @ 2007-02-21 18:58 UTC (permalink / raw)
To: help-gnu-emacs
Hi
I need to replace
452452451 1.4445 1.4254
with
452452451 1 1
so I started by search regex to find if I can get the regex correct.
^\\d* \\d\\.\\d* \\d\\.\\d*$
is reporting fail as soon as I type the second "\" in the line.
how can I do this task?
many thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: query replace regex
2007-02-21 18:58 query replace regex Gary Wessle
@ 2007-02-21 19:23 ` james
2007-02-21 19:38 ` james
1 sibling, 0 replies; 3+ messages in thread
From: james @ 2007-02-21 19:23 UTC (permalink / raw)
To: help-gnu-emacs
On Feb 21, 12:58 pm, Gary Wessle <phd...@yahoo.com> wrote:
> Hi
> I need to replace
> 452452451 1.4445 1.4254
> with
> 452452451 1 1
>
> so I started by search regex to find if I can get the regex correct.
> ^\\d* \\d\\.\\d* \\d\\.\\d*$
> is reporting fail as soon as I type the second "\" in the line.
>
> how can I do this task?
>
> many thanks
There is no \d in emacs regexen. Use [0-9] instead.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: query replace regex
2007-02-21 18:58 query replace regex Gary Wessle
2007-02-21 19:23 ` james
@ 2007-02-21 19:38 ` james
1 sibling, 0 replies; 3+ messages in thread
From: james @ 2007-02-21 19:38 UTC (permalink / raw)
To: help-gnu-emacs
On Feb 21, 12:58 pm, Gary Wessle <phd...@yahoo.com> wrote:
> Hi
> I need to replace
> 452452451 1.4445 1.4254
> with
> 452452451 1 1
>
> so I started by search regex to find if I can get the regex correct.
> ^\\d* \\d\\.\\d* \\d\\.\\d*$
> is reporting fail as soon as I type the second "\" in the line.
>
> how can I do this task?
>
> many thanks
Also, for the literal period, you're double escaping it. A single \.
will do when orompted interactively. You only need to double-escape
them when using the regex is read from source, such as:
(add-to-list 'auto-mode-alist '("\\.php3?\\'" . sgml-html-mode))
The first escape is for the lisp reader(parser), the second is for the
regex parser.
Since you're more familiar with perly-regexen, you should also note
that a paren is taken literally. To use it for grouping you need to
escape it:
^\([0-9]*\) \([0-9]*\)\.[0-9]* \([0-9]*\)\.[0-9]*$
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-21 19:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-21 18:58 query replace regex Gary Wessle
2007-02-21 19:23 ` james
2007-02-21 19:38 ` james
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.