help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: HTML img tags


From: Konstantin Shakhnov
Subject: Re: HTML img tags
Date: Wed, 14 Dec 2016 16:27:31 +0300
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Dec 14, 2016 at 11:48:01AM +0100, tomas@tuxteam.de wrote:
> Or, just "pulling in" the sed (and consolidating it with the already
> present `replace-regexp-in-string'):
>
>     (replace-regexp-in-string
>       "^.* \\([0-9]+\\)x\\([0-9]+\\) \\(:?.\\|\n\\)*$"
>       "width=\\1 height=\\2"
>       (shell-command-to-string
>         (format "identify %s" filename)))

Great idea.

> The funny construction at the end of regexp \\(:.\\|\n\\) is there
> because dot alone won't match the \n. I don't know whether this
> can be expressed more readably/elegantly.

"^.* \\([0-9]+\\)x\\([0-9]+\\) .*\n$" works well. Or
"^.*\\([0-9]+\\)x\\([0-9]+\\) .*\n?$" if we not sure if there is an '\n'
at the end of string



reply via email to

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