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