all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Regexp that solves this ?
@ 2007-08-29 18:07 weber
  2007-08-29 18:31 ` Malte Spiess
  2007-08-29 18:37 ` Emilio Lopes
  0 siblings, 2 replies; 4+ messages in thread
From: weber @ 2007-08-29 18:07 UTC (permalink / raw)
  To: help-gnu-emacs

Hi folks.
I'd like to know if there is a simple way to replace regexp a file to
convert tables like this:

| name | value |
| x1   | 1001  |
| x2   | 2002  |

to this

|| name | value |
| x1   | 1001  |
| x2   | 2002  |

The problem is having a regexp that depends on the next line.

Ideas?
-weber

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

* Re: Regexp that solves this ?
  2007-08-29 18:07 Regexp that solves this ? weber
@ 2007-08-29 18:31 ` Malte Spiess
  2007-08-29 18:54   ` weber
  2007-08-29 18:37 ` Emilio Lopes
  1 sibling, 1 reply; 4+ messages in thread
From: Malte Spiess @ 2007-08-29 18:31 UTC (permalink / raw)
  To: help-gnu-emacs

weber <hugows@gmail.com> writes:

> Hi folks.
> I'd like to know if there is a simple way to replace regexp a file to
> convert tables like this:
>
> | name | value |
> | x1   | 1001  |
> | x2   | 2002  |
>
> to this
>
> || name | value |
> | x1   | 1001  |
> | x2   | 2002  |

I don't really see what exactly you want to replace...
"| name" by "|| name" ? Probably not...

> The problem is having a regexp that depends on the next line.

Well, this is no problem. Just type C-q C-j to get a newline in the
minibuffer.

> Ideas?
> -weber

Greetings
Malte

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

* Re: Regexp that solves this ?
  2007-08-29 18:07 Regexp that solves this ? weber
  2007-08-29 18:31 ` Malte Spiess
@ 2007-08-29 18:37 ` Emilio Lopes
  1 sibling, 0 replies; 4+ messages in thread
From: Emilio Lopes @ 2007-08-29 18:37 UTC (permalink / raw)
  To: help-gnu-emacs

weber  writes:

> I'd like to know if there is a simple way to replace regexp a file to
> convert tables like this:

> | name | value |
> | x1   | 1001  |
> | x2   | 2002  |

> to this

> || name | value |
> | x1   | 1001  |
> | x2   | 2002  |

Does the following works?

    (query-replace-regexp "^[[:space:]]*\n|[^|]" "\n||")

When calling `query-replace-regexp' interactively use "^Q^J" to input
a newline, instead of "\n" as above.

-- 
Emílio C. Lopes
Munich, Germany

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

* Re: Regexp that solves this ?
  2007-08-29 18:31 ` Malte Spiess
@ 2007-08-29 18:54   ` weber
  0 siblings, 0 replies; 4+ messages in thread
From: weber @ 2007-08-29 18:54 UTC (permalink / raw)
  To: help-gnu-emacs

On 29 ago, 15:31, Malte Spiess <i1tn...@arcor.de> wrote:
> weber <hug...@gmail.com> writes:
> > Hi folks.
> > I'd like to know if there is a simple way to replace regexp a file to
> > convert tables like this:
>
> > | name | value |
> > | x1   | 1001  |
> > | x2   | 2002  |
>
> > to this
>
> > || name | value |
> > | x1   | 1001  |
> > | x2   | 2002  |
>
> I don't really see what exactly you want to replace...
> "| name" by "|| name" ? Probably not...
>
> > The problem is having a regexp that depends on the next line.
>
> Well, this is no problem. Just type C-q C-j to get a newline in the
> minibuffer.
>
> > Ideas?
> > -weber
>
> Greetings
> Malte

Yes, exactly. I'm converting between org-mode tables and another
format (t2t) which uses similar tables.
Greets,
weber

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

end of thread, other threads:[~2007-08-29 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-29 18:07 Regexp that solves this ? weber
2007-08-29 18:31 ` Malte Spiess
2007-08-29 18:54   ` weber
2007-08-29 18:37 ` Emilio Lopes

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.