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

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

Re: Shortening words in region


From: uzibalqa
Subject: Re: Shortening words in region
Date: Sat, 13 Aug 2022 18:19:33 +0000





Sent with Proton Mail secure email.

------- Original Message -------
On Saturday, August 13th, 2022 at 5:42 PM, Jean Louis <bugs@gnu.support> wrote:


> * uzibalqa via Users list for the GNU Emacs text editor 
> help-gnu-emacs@gnu.org [2022-08-13 19:34]:
>
> > Have been working on shortening words. But doing so on a word by
> > word basis is quite slow. Thusly I am writing a version that accepts
> > a selected region.
> >
> > This function uses a selected region, then changes initial parts oy
> > words (replacing matching cog, col, com, con, cor, coun, and cum
> > with the letter "k".
>
>
> (rx (zero-or-more (or "col" "cog" "com" "con" "cor" "coun" "cum"))) ⇒ 
> "\\(?:c\\(?:o\\(?:un\\|[glmnr]\\)\\|um\\)\\)*"
>
> {C-h f rx RET}
>
> --
> Jean

Like below?

(insert (replace-regexp-in-string
   (rx (zero-or-more (or "col" "cog" "com" "con" "cor" "coun" "cum")))
   "k" word))






reply via email to

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