[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : At least one character at beginning and end of words
From: |
tomas |
Subject: |
Re: [External] : At least one character at beginning and end of words |
Date: |
Mon, 15 Aug 2022 11:48:36 +0200 |
On Mon, Aug 15, 2022 at 09:25:50AM +0000, uzibalqa wrote:
> ------ Original Message -------
> On Monday, August 15th, 2022 at 4:36 AM, <tomas@tuxteam.de> wrote:
>
>
> > On Sun, Aug 14, 2022 at 11:43:10PM +0000, Drew Adams wrote:
> >
> > > > I want to match the sequence "at least one letter" then "ple"
> > > > then "at least one letter". How would a regexp look like.?
> > >
> > > "[:alpha:]+ple[:alpha:]+"
> > >
> > > I think you should spend some time reading the Elisp manual section on
> > > regexps.
>
> Although I have done
>
> (insert (replace-regexp-in-string
> "\\([:alpha:]+\\)ple\\([:alpha:]+\\)" "\\1p\\2" word))
>
> word is being left intact.
It's all in the manual, which you consistently ignore. Please do have
a look at it.
The [: ... :] character classes only go into the character class brackets
(i.e. [ ... ]). So you need two pairs of brackets, like so: [[:alpha:]].
Yes, it looks strange. But it starts making sense when you want to combine
things (e.g. alpha plus comma or dash: [[:alpha:],-])
Please, look into the manual. It takes some effort, but it's worth it.
Cheers
--
t
signature.asc
Description: PGP signature