[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SOLVED] Re: (rx regexp to remove space and new lines
From: |
Jean Louis |
Subject: |
Re: [SOLVED] Re: (rx regexp to remove space and new lines |
Date: |
Thu, 15 Sep 2022 11:22:23 +0300 |
User-agent: |
Mutt/+ () (2022-06-11) |
* Michael Heerdegen <michael_heerdegen@web.de> [2022-09-15 05:29]:
> Jean Louis <bugs@gnu.support> writes:
>
> > > (rx blank) might be the better choice. Adding CR and LF to the
> > > puzzle, I'd use (rx (any "\n\r" blank))
> >
> > Thanks, I have tried it here:
> >
> > (defun rcd-string-clean-whitespace (s)
> > "Return trimmed string S after cleaning whitespaces."
> > (replace-regexp-in-string
> > (rx (one-or-more blank))
>
> The newline is missing.
This is version that works. I can interchange (any whitespace) with
(any blank), but none of them recognizes "\n" as whitespace so far.
(defun rcd-string-clean-whitespace (s)
"Return trimmed string S after cleaning whitespaces."
(replace-regexp-in-string
(rx (one-or-more (or "\n" (any whitespace))))
" "
(string-trim s)))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
- [SOLVED] Re: (rx regexp to remove space and new lines, (continued)
- [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
- Re: [SOLVED] Re: (rx regexp to remove space and new lines, Michael Heerdegen, 2022/09/14
- Re: [SOLVED] Re: (rx regexp to remove space and new lines,
Jean Louis <=
Re: (rx regexp to remove space and new lines, Michael Heerdegen, 2022/09/12