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

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

Re: [External] : Use the characters "+" and "-" in regular expressions


From: tomas
Subject: Re: [External] : Use the characters "+" and "-" in regular expressions
Date: Thu, 20 May 2021 12:50:35 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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

Attachment: signature.asc
Description: Digital signature


reply via email to

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