unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: steve-humphreys@gmx.com
To: Christopher Dimech <dimech@gmx.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: [External] :  Use the characters "+" and "-" in regular expressions
Date: Thu, 20 May 2021 13:40:23 +0200	[thread overview]
Message-ID: <trinity-66c4fd6d-ba99-4938-b159-5ae2d54e81c4-1621510822976@3c-app-mailcom-bs16> (raw)
In-Reply-To: <trinity-dbac65e9-62c3-4e76-9bb6-affc71398218-1621510282255@3c-app-mailcom-bs16>



> Sent: Thursday, May 20, 2021 at 11:31 PM
> From: "Christopher Dimech" <dimech@gmx.com>
> To: steve-humphreys@gmx.com
> Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> Subject: [External] :  Use the characters "+" and "-" in regular expressions
>
> This could be what you need
>
>   (string-match "[\s]+ " s)
>
> Matches any white-space character.

That would actually match a sentence, which I don't want.

What I like to match is a string composed only of whitespace.

> > Sent: Thursday, May 20, 2021 at 11:19 PM
> > From: steve-humphreys@gmx.com
> > To: tomas@tuxteam.de
> > Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> > Subject: Re: [External] :  Use the characters "+" and "-" in regular expressions
> >
> > This is a string of blanks, a string composed of whitespace of any length.
> >
> > "                     "
> >
> >
> >
> > > Sent: Thursday, May 20, 2021 at 10:50 PM
> > > From: tomas@tuxteam.de
> > > To: steve-humphreys@gmx.com
> > > Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> > > Subject: Re: [External] :  Use the characters "+" and "-" in regular expressions
> > >
> > > On Thu, May 20, 2021 at 12:37:17PM +0200, steve-humphreys@gmx.com wrote:
> > >
> > > [...]
> > >
> > > > Done some tests and got some strange results that thought would not match.  Then things
> > > > made more sense after your clarification because when I looked at some of the strings,
> > > > there was a comma in them.
> > >
> > > OK. Glad I could help.
> > >
> > > > Am seeing how to match strings of blank lines
> > >
> > > What is "a string of blank lines"?
> > >
> > > I know strings of characters. But a line is not a character.
> > >
> > > Do you mean "several blank lines next to each other"? I don't
> > > think so. But what do you mean?
> > >
> > > > But " +" does not do the job.
> > >
> > > Again: you know by now that this will match "one or more spaces". Is
> > > that for you a "string of blanks" (huh: where did you leave the
> > > "line" from above?) or not?
> > >
> > > >                  I know why, but how can one match strings of blanks?
> > >
> > > To even have a chance to do that, you'll have to get hold of a more
> > > or less precise idea of what "a string of blanks" is. This is work.
> > >
> > > Begin with:
> > >
> > >   (string-match " +" "A summer full of butterflies")
> > >   => 1
> > >
> > > Bingo: the first run of one-or-more spaces is at the position 1
> > > (the first position in the string is 0, the "A"). So it's working
> > > as it should.
> > >
> > > So what is /your/ idea of "a string of blank lines" or "a string
> > > of blanks"? Only you can find out.
> > >
> > > If you feel you are stuck in that task, it sometimes help to collect
> > > a couple of examples and counter-examples (they'll come in handy
> > > when you try to test your attempts).
> > >
> > > Cheers
> > >  - t
> > >
> >
> >
>
>



  reply	other threads:[~2021-05-20 11:40 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 16:07 Use the characters "+" and "-" in regular expressions steve-humphreys
2021-05-19 16:17 ` Skip Montanaro
2021-05-19 16:26   ` steve-humphreys
2021-05-19 16:47     ` Yuri Khan
2021-05-19 17:39       ` steve-humphreys
2021-05-19 19:16         ` tomas
2021-05-19 19:27           ` tomas
2021-05-19 19:30         ` Yuri Khan
2021-05-19 21:32           ` tomas
2021-05-19 21:59             ` [External] : " Drew Adams
2021-05-20  6:26               ` RE: [External] : " steve-humphreys
2021-05-20  7:59                 ` steve-humphreys
2021-05-20  8:26                   ` tomas
2021-05-20  8:41                     ` steve-humphreys
2021-05-20  9:42                     ` steve-humphreys
2021-05-20  9:56                       ` tomas
2021-05-20 10:11                         ` steve-humphreys
2021-05-20 10:22                           ` tomas
2021-05-20 10:37                             ` steve-humphreys
2021-05-20 10:50                               ` tomas
2021-05-20 11:19                                 ` steve-humphreys
2021-05-20 11:27                                   ` steve-humphreys
2021-05-20 12:04                                     ` tomas
2021-05-20 11:31                                   ` Christopher Dimech
2021-05-20 11:40                                     ` steve-humphreys [this message]
2021-05-20 11:49                                       ` Christopher Dimech
2021-05-20 13:03                                       ` Jean Louis
2021-05-20 11:59                                     ` tomas
2021-05-20 12:53                                     ` Jean Louis
2021-05-20 12:46                               ` Jean Louis
2021-05-20 13:55                                 ` steve-humphreys
2021-05-20 14:14                                   ` Jean Louis
2021-05-20 14:28                                     ` steve-humphreys
2021-05-20 16:24                                       ` Yuri Khan
2021-05-20 16:34                                         ` steve-humphreys
2021-05-20 17:16                                           ` Eduardo Ochs
2021-05-20 18:29                                             ` Drew Adams
2021-05-21  5:48                                       ` Jean Louis
2021-05-20 12:39                       ` Jean Louis
2021-05-20  7:15               ` Dash in regexp character classes: Beginnig vs. end [was: Use the characters "+" and "-" in regular expressions] tomas
2021-05-20  8:08                 ` Robert Pluim
2021-05-19 19:26       ` [External] : Re: Use the characters "+" and "-" in regular expressions Drew Adams
2021-05-19 19:25     ` Drew Adams
2021-05-19 16:27   ` tomas
2021-05-19 16:39     ` Skip Montanaro
2021-05-19 17:43       ` Marcin Borkowski
2021-05-19 19:10       ` tomas
2021-05-19 19:17 ` [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-66c4fd6d-ba99-4938-b159-5ae2d54e81c4-1621510822976@3c-app-mailcom-bs16 \
    --to=steve-humphreys@gmx.com \
    --cc=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).