unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: regular expression
@ 2014-07-02 13:10 Tak Kunihiro
  2014-07-02 13:43 ` Stefan Monnier
  0 siblings, 1 reply; 17+ messages in thread
From: Tak Kunihiro @ 2014-07-02 13:10 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: embe8573

I think a work flow from (re-builder) to (query-replace-regexp) should
be by default in Emacs.

Tweaks are necessary; however, the idea is demonstrated such in
 https://gist.github.com/mooz/890562

I suggest following key bindings.
 (global-set-key (kbd "C-M-%") 're-builder)
 (define-key reb-mode-map (kbd "<return>") 'my-reb-query-replace-regexp)



^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: regular expression
@ 2014-07-02 23:14 Tak Kunihiro
  0 siblings, 0 replies; 17+ messages in thread
From: Tak Kunihiro @ 2014-07-02 23:14 UTC (permalink / raw)
  To: help-gnu-emacs

> > I think a work flow from (re-builder) to (query-replace-regexp) should
> > be by default in Emacs.
> 
> Maybe the right way to do it is to integrate re-builder into isearch
> (when searching with a regexp), to benefit from the existing work flow
> from isearch to query-replace.

A window dedicated for re-builder can be regarded as mini buffer.

With following setup, it is almost similar to isearch with regexp.
(define-key reb-mode-map (kbd "C-s") 'reb-next-match)
(define-key reb-mode-map (kbd "C-r") 'reb-prev-match)
(define-key reb-mode-map (kbd "C-g") 'reb-quit)
(define-key reb-mode-map (kbd "<return>") 'my-query-replace-regexp)

Minor concern is re-builder looks from beginning of current buffer
instead from where the point is.

I think to bind re-builder to "C-M-s" is a good idea, although coding
is beyond my capability.



^ permalink raw reply	[flat|nested] 17+ messages in thread
[parent not found: <mailman.4622.1404173952.1147.help-gnu-emacs@gnu.org>]
* Re: regular expression
@ 2014-06-30 23:14 Tak Kunihiro
  0 siblings, 0 replies; 17+ messages in thread
From: Tak Kunihiro @ 2014-06-30 23:14 UTC (permalink / raw)
  To: renato.pontefice; +Cc: help-gnu-emacs

> 40 STREET DW...
>
> I want to made substitution like this:
>
> 40#STREEDW...
>
> can someone help me to build this expression?

Use `re-builder' and `query-replace-regexp'.

Play on (re-builder) with following setup, then copy regexp that is
inside of ".  Call (query-replace-regexp) for substitution.

(setq reb-re-syntax 'string)



^ permalink raw reply	[flat|nested] 17+ messages in thread
[parent not found: <d5b8df44-60fd-4b8f-83d1-cb7d04b2a7b4@googlegroups.com>]
* regular expression
@ 2010-01-25 11:00 Burkhard Schultheis
  2010-01-25 12:35 ` Nuno J. Silva
  2010-01-25 18:12 ` Stefan Monnier
  0 siblings, 2 replies; 17+ messages in thread
From: Burkhard Schultheis @ 2010-01-25 11:00 UTC (permalink / raw)
  To: help-gnu-emacs

I want to search for the following string: A hyphen not surrounded by 
spaces. Therefore I tried the following pattern:
[^ ]-[^ ].
But this pattern finds a hyphen preceded by a letter and followed by a 
newline character, too.

How to exclude the newline character? I tried
[^ ]-[^ \n]
but that does not work. Why? And how to search for this?

Thank you in advance!

Regards
Burkhard


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-07-02 23:14 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-02 13:10 regular expression Tak Kunihiro
2014-07-02 13:43 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2014-07-02 23:14 Tak Kunihiro
     [not found] <mailman.4622.1404173952.1147.help-gnu-emacs@gnu.org>
2014-07-02  8:33 ` Emanuel Berg
2014-06-30 23:14 Tak Kunihiro
     [not found] <d5b8df44-60fd-4b8f-83d1-cb7d04b2a7b4@googlegroups.com>
2014-06-30 20:04 ` Emanuel Berg
2014-06-30 20:13   ` Emanuel Berg
2014-06-30 20:36     ` Teemu Likonen
     [not found]     ` <mailman.4605.1404160609.1147.help-gnu-emacs@gnu.org>
2014-06-30 20:52       ` Emanuel Berg
2014-06-30 21:04         ` Teemu Likonen
     [not found]         ` <mailman.4609.1404162300.1147.help-gnu-emacs@gnu.org>
2014-06-30 21:11           ` Emanuel Berg
2010-01-25 11:00 Burkhard Schultheis
2010-01-25 12:35 ` Nuno J. Silva
2010-01-25 12:53   ` Helmut Eller
2010-01-26 19:46     ` Nuno J. Silva
2010-01-25 16:34   ` Burkhard Schultheis
2010-01-25 18:12 ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).