9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: kalterdev@gmail.com
To: 9fans <9fans@9fans.net>
Subject: [9fans] Sam: Is This a Bug?
Date: Thu, 3 Oct 2024 17:37:14 -0400	[thread overview]
Message-ID: <17279914340.924A1d.733851@composer.9fans.topicbox.com> (raw)

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

Consider the following sample text:

foo
bar
baz
qux
quux

The purpose is to merge each pair of words, so that the text becomes:

foobar
bazqux
quux

The following command works fine:

x/.+\n.+/ x/\n/ d

But the following one does not:

x/.*\n.*/ x/\n/ d

It results in all \n being deleted.

I suppose it's because .* matches an empty string in this case. But
it really shouldn't. Sam's regular expressions are leftmost-longest.
And there's seemingly nothing that must stop both .* from extending.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/Tabb641f45805a1fc-M3a459815536caaee8e5401c5
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 1669 bytes --]

             reply	other threads:[~2024-10-03 21:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 21:37 kalterdev [this message]
2024-10-03 21:55 ` umbraticus
2024-10-03 22:01   ` kalterdev

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

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

  git send-email \
    --in-reply-to=17279914340.924A1d.733851@composer.9fans.topicbox.com \
    --to=kalterdev@gmail.com \
    --cc=9fans@9fans.net \
    /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 NNTP newsgroup(s).