unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* At least one character at beginning and end of words
@ 2022-08-14 21:08 uzibalqa via Users list for the GNU Emacs text editor
  2022-08-14 23:43 ` [External] : " Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: uzibalqa via Users list for the GNU Emacs text editor @ 2022-08-14 21:08 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

I want to match the sequence "at least one letter" then "ple" then "at least one letter". How would a regexp look like.?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [External] : At least one character at beginning and end of words
  2022-08-14 21:08 At least one character at beginning and end of words uzibalqa via Users list for the GNU Emacs text editor
@ 2022-08-14 23:43 ` Drew Adams
  2022-08-15  4:36   ` tomas
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2022-08-14 23:43 UTC (permalink / raw)
  To: uzibalqa, 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

> 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.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Regular-Expressions.html

And maybe read up elsewhere about regexps:

https://www.oreilly.com/library/view/mastering-regular-expressions/0596528124/

Then you can help others with their questions about regexps...

[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13898 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [External] : At least one character at beginning and end of words
  2022-08-14 23:43 ` [External] : " Drew Adams
@ 2022-08-15  4:36   ` tomas
  2022-08-15  9:25     ` uzibalqa
  0 siblings, 1 reply; 6+ messages in thread
From: tomas @ 2022-08-15  4:36 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

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.

I'd recommend that, too.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [External] : At least one character at beginning and end of words
  2022-08-15  4:36   ` tomas
@ 2022-08-15  9:25     ` uzibalqa
  2022-08-15  9:48       ` tomas
  0 siblings, 1 reply; 6+ messages in thread
From: uzibalqa @ 2022-08-15  9:25 UTC (permalink / raw)
  To: tomas; +Cc: help-gnu-emacs

------ 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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [External] : At least one character at beginning and end of words
  2022-08-15  9:25     ` uzibalqa
@ 2022-08-15  9:48       ` tomas
  2022-08-15 10:26         ` uzibalqa
  0 siblings, 1 reply; 6+ messages in thread
From: tomas @ 2022-08-15  9:48 UTC (permalink / raw)
  To: uzibalqa; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [External] : At least one character at beginning and end of words
  2022-08-15  9:48       ` tomas
@ 2022-08-15 10:26         ` uzibalqa
  0 siblings, 0 replies; 6+ messages in thread
From: uzibalqa @ 2022-08-15 10:26 UTC (permalink / raw)
  To: tomas; +Cc: help-gnu-emacs

------- Original Message -------
On Monday, August 15th, 2022 at 9:48 AM, <tomas@tuxteam.de> wrote:


> 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:],-])

Yes, it makes sense.

> Please, look into the manual. It takes some effort, but it's worth it.
>
> Cheers
> --
> t



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-15 10:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-14 21:08 At least one character at beginning and end of words uzibalqa via Users list for the GNU Emacs text editor
2022-08-14 23:43 ` [External] : " Drew Adams
2022-08-15  4:36   ` tomas
2022-08-15  9:25     ` uzibalqa
2022-08-15  9:48       ` tomas
2022-08-15 10:26         ` uzibalqa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).