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

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

Re: "split-sentences"?


From: Emanuel Berg
Subject: Re: "split-sentences"?
Date: Sat, 23 Jan 2021 10:35:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

tomas wrote:

> Not exactly your result, but this comes close:
>
>   (split-string "'This sentence is spoken by Mr. W. E.
>     B Dubois, Esq.!' played through amazon.com alexa
>     speakers?" "[[:punct:]][[:space:]]*")
>
> =>
>
>   (""
>    "This sentence is spoken by Mr"
>    "W"
>    "E"
>    "B Dubois"
>    "Esq"
>    ""
>    ""
>    "played through amazon"
>    "com alexa speakers"
>    "")
>
> You can adjust the results by tweaking the regexp (try word
> boundaries like '\<' and '\>'

*scratches my head*

> if you want to keep punctuation) or the other split-string's
> optional params (e.g. drop the empty matches, etc.).

Well, that's a start, for sure. Thanks :)

Silly me, I already used `split-string' 10 times...

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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