emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: <tomas@tuxteam.de>
To: emacs-orgmode@gnu.org
Subject: Re: Mass conversion of items
Date: Tue, 1 Sep 2020 19:36:45 +0200	[thread overview]
Message-ID: <20200901173645.GB20966@tuxteam.de> (raw)
In-Reply-To: <87blipl8ed.fsf@skimble.plus.com>

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

On Tue, Sep 01, 2020 at 06:22:02PM +0100, Sharon Kimble wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> Thanks for replying Tomas.
>   <tomas@tuxteam.de> writes:

You're welcome :-)

[...]

> >> - --8<---------------cut here---------------start------------->8---
> >> \uuline{foo}
> >> - --8<---------------cut here---------------end--------------->8---

[...]

> >> - --8<---------------cut here---------------start------------->8---
> >> /\uuline{foo}/
> >> - --8<---------------cut here---------------end--------------->8---

[...]

> Okay, being very specific, all of '\uuline{foo}' remains, but with a
> forward slash at the beginning and end of '\uuline{foo}' to achieve this
> '/\uuline{foo}/'

Ah, got it now. Regular expressions seem to be your friends here.

I'm assuming your foo is a placeholder, and varies from instance
to instance. I'm further assuming the "foo"s don't contain a closing
curly brace (we'd have to refine things otherwise).

Try M-x (i.e. Meta-x) and then "query-replace-regexp". It asks you
first for the regular expression, which will be

  \\uuline{[^}]*}

(note the double backslash: that's because a backslash has a special
meaning in regular expressions, and you have to "escape" it with another
backslash; this regexp roughly states: "a backslash followed by uuline,
followed by an opening curly, followed by zero or more (that's the star)
characters which aren't a closing curly followed by a closing curly).

You finish that part with ENTER. Then you're asked for the replacement.
You enter

  /\&/

Which means: "a slash, followed by whatever you just matched (that's
the "\&" part, only one backslash this time) and a slash.

Make a backup of your file first :-)

Regular expressions are very powerful, but sometimes confusing. It pays
off big time to wrangle them!
 
Good luck
 - t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2020-09-01 17:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-01 15:09 Mass conversion of items Sharon Kimble
2020-09-01 16:14 ` tomas
2020-09-01 17:22   ` Sharon Kimble
2020-09-01 17:36     ` tomas [this message]
2020-09-01 16:19 ` Eric S Fraga
2020-09-01 17:12   ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200901173645.GB20966@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).