[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (rx regexp to remove space and new lines
From: |
tomas |
Subject: |
Re: (rx regexp to remove space and new lines |
Date: |
Mon, 12 Sep 2022 12:13:14 +0200 |
On Mon, Sep 12, 2022 at 12:25:58PM +0300, Jean Louis wrote:
> I would like to construct rx regexp to remove both whitespace
> characters and new line "\n" to replace it with only one space " ".
>
> How to do it?
>
> (string-replace (rx (one-or-more (any "\n" "[[:space:]]"))) " " sql)))))
This looks about correct, so I don't understand your question. In which way
this does fail? Don't make us solve riddles ;-)
Note that [:space:] includes "\n" (and vertical tabulator and other ilks
of space-y characters), so the (any "\n" "[[:space:]]") seems redundant
and "[[:space:]]" should suffice.
I'm not very fluent on Rx, but I'd double check whether it takes "[[:space:]]"
as syntax.
Cheers
--
t
signature.asc
Description: PGP signature
- (rx regexp to remove space and new lines, Jean Louis, 2022/09/12
- Re: (rx regexp to remove space and new lines,
tomas <=
- Re: (rx regexp to remove space and new lines, Jean Louis, 2022/09/12
- [SOLVED] Re: (rx regexp to remove space and new lines, Jean Louis, 2022/09/12
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, Michael Heerdegen, 2022/09/12
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, Jean Louis, 2022/09/13
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, Michael Heerdegen, 2022/09/13
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, tomas, 2022/09/13
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, Michael Heerdegen, 2022/09/13
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, tomas, 2022/09/13
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, Michael Albinus, 2022/09/13
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, Jean Louis, 2022/09/14