A problem with one exercise

Salve a tutti.

Mi chiamo Angelo e da qualche mese so imparando ad
usare Ruby su un tutorial.

Ultimamente non riesco a risolvere un
esercizio e così mi rivolgo a questa Comunità .

Il programma in
questione è il seguente:

# encoding: utf-8

comando = ' '

if
(comando.capitalize != 'Stop')

while (comando.capitalize != 'Stop')

comando = gets.chomp

puts 'Il gallo è morto'

puts 'Il gallo è
morto'

puts 'E più non canterà coccodì e coccodà '

puts 'E più non
canterà coccodì e coccodà '

puts 'Uè!'

puts ' '

end

if
(comando.capitalize == 'Stop')

puts ' '

puts 'OK la smetto :-)'

end

end

pausa = gets

Il risultato è che finché non digito 'stop'
il programma mi restituisce la canzoncina ad ogni invio.

Ma quando
digito 'stop' il programma mi restituisce:

Il gallo è morto

Il gallo
è morto

E più non canterà coccodì e coccodÃ

E più non canterÃ
coccodì e coccodÃ

'Uè!

OK la smetto :slight_smile:

Io invece vorrei che
digitando il comando 'stop' il programma mi restituisca solo:

OK la
smetto :slight_smile:

Qualcuno mi può dire la soluzione di questo problema?

Grazie a tutti.

Angelo

Hello everyone.

My name is Angelo and for
some months I have been learning how to use Ruby on a tutorial.

Lately
I have not been able to solve an exercise and so I turn to this
community.

The program in question is as follows:

# encoding: utf-8

command = ''

if (command.capitalize! = 'Stop')

while
(command.capitalize! = 'Stop')

command = gets.chomp

puts 'The
rooster is dead'

puts 'The rooster is dead'

puts 'And the more he
will not sing cuddly and cuddly'

puts 'And no more will he sing huff
and huff'

puts 'Hey!'

puts ''

end

if (command.capitalize ==
'Stop')

puts ''

puts 'OK I'll stop :-)'

end

end

pause = gets

The result is that until I type 'stop', the program returns the song
to me at each sending.

But when I type 'stop' the program gives me:

The rooster died

The rooster died

And no longer will he sing
cuddly and cuddly

And no longer will he sing cuddly and cuddly

'Uè!

Ok I'll stop :slight_smile:

On the other hand, I would like the program to
return me only by typing the 'stop' command:

Ok I'll stop :slight_smile:

Can
anyone tell me the solution of this problem?

Thank you all.

Angelo

···

--

_ANGELO BALDELLI _
   
Con Tiscali Mobile Smart 70 hai 70 GB in 4G, minuti illimitati e 100 SMS a soli 7,99€ al mese Offerte Telefonia mobile voce e Internet - Tiscali Casa

Try this:

while (command = gets)
command = gets.chomp
break if command.capitalize == 'Stop'
puts "Hello hello"
end
puts "Goodbye"

···

On 10/14/21 17:14, Angelo Baldelli wrote:

Salve a tutti.

Mi chiamo Angelo e da qualche mese so imparando ad usare Ruby su un tutorial.

Ultimamente non riesco a risolvere un esercizio e così mi rivolgo a questa Comunità.

Il programma in questione è il seguente:

# encoding: utf-8

comando = ' '

if (comando.capitalize != 'Stop')

            while \(comando\.capitalize \!= 'Stop'\)

                           comando = gets\.chomp

                           puts 'Il gallo è morto'

                           puts 'Il gallo è morto'

                           puts 'E più non canterà coccodì e coccodà'

                           puts 'E più non canterà coccodì e coccodà'

                           puts 'Uè\!'

                           puts ' '

            end

if (comando.capitalize == 'Stop')

            puts ' '

            puts 'OK la smetto :\-\)'

end

end

pausa = gets

Il risultato è che finché non digito ‘stop’ il programma mi restituisce la canzoncina ad ogni invio.

Ma quando digito ‘stop’ il programma mi restituisce:

Il gallo è morto

Il gallo è morto

E più non canterà coccodì e coccodà

E più non canterà coccodì e coccodà

'Uè!

OK la smetto :slight_smile:

Io invece vorrei che digitando il comando ‘stop’ il programma mi restituisca solo:

OK la smetto :slight_smile:

Qualcuno mi può dire la soluzione di questo problema?

Grazie a tutti.

Angelo

Hello everyone.

My name is Angelo and for some months I have been learning how to use Ruby on a tutorial.

Lately I have not been able to solve an exercise and so I turn to this community.

The program in question is as follows:

# encoding: utf-8

command = ''

if (command.capitalize! = 'Stop')

while (command.capitalize! = 'Stop')

command = gets.chomp

puts 'The rooster is dead'

puts 'The rooster is dead'

puts 'And the more he will not sing cuddly and cuddly'

puts 'And no more will he sing huff and huff'

puts 'Hey!'

puts ''

end

if (command.capitalize == 'Stop')

puts ''

puts 'OK I'll stop :-)'

end

end

pause = gets

The result is that until I type 'stop', the program returns the song to me at each sending.

But when I type 'stop' the program gives me:

The rooster died

The rooster died

And no longer will he sing cuddly and cuddly

And no longer will he sing cuddly and cuddly

'Uè!

Ok I'll stop :slight_smile:

On the other hand, I would like the program to return me only by typing the 'stop' command:

Ok I'll stop :slight_smile:

Can anyone tell me the solution of this problem?

Thank you all.

Angelo

--
/*Angelo Baldelli */

Con Tiscali Mobile Smart 70 hai 70 GB in 4G, minuti illimitati e 100 SMS a soli 7,99€ al mese Offerte Telefonia Mobile e Internet | Tiscali

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Hi!

#gets only 1 times...

while (command=gets.chomp)
puts 'song...' #
break if command.capitalize == 'Stop'
end
puts "Stop was pressed"

# is more or less the same as the solution above.
# I would prefer if there was be only 1 solution (do...while ?), but
there are many many ways how this could be done.

Opti

···

Am 14.10.21 um 17:18 schrieb hmdne:

Try this:

while (command = gets)
command = gets.chomp
break if command.capitalize == 'Stop'
puts "Hello hello"
end
puts "Goodbye"

Ruby has a do...while loop:

begin
expression
end while rule

But this syntax is frowned upon and it's preferred to use this syntax:

loop do
expression
break if rule
end

···

On 10/14/21 17:59, Die Optimisten wrote:

Am 14.10.21 um 17:18 schrieb hmdne:

Try this:

while (command = gets)
command = gets.chomp
break if command.capitalize == 'Stop'
puts "Hello hello"
end
puts "Goodbye"

Hi!

#gets only 1 times...

while (command=gets.chomp)
puts 'song...' #
break if command.capitalize == 'Stop'
end
puts "Stop was pressed"

# is more or less the same as the solution above.
# I would prefer if there was be only 1 solution (do...while ?), but
there are many many ways how this could be done.

Opti

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Unsubscribe

···

On Thu, 14 Oct 2021 at 6:59 PM Die Optimisten <inform@die-optimisten.net> wrote:

Am 14.10.21 um 17:18 schrieb hmdne:
> Try this:
>
> while (command = gets)
> command = gets.chomp
> break if command.capitalize == 'Stop'
> puts "Hello hello"
> end
> puts "Goodbye"
>
Hi!

#gets only 1 times...

while (command=gets.chomp)
   puts 'song...' #
   break if command.capitalize == 'Stop'
end
puts "Stop was pressed"

# is more or less the same as the solution above.
# I would prefer if there was be only 1 solution (do...while ?), but
there are many many ways how this could be done.

Opti

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

--
Anas Tammam

For stuff like this, I prefer `until`, so here's how I would do it:

until((command = gets.chomp).match(/stop/i))
puts "song"
end

puts "OK, I'll stop"

As said, there are many many ways this could be done. I probably wouldn't
even bother to store in the `command` variable unless there was a very
compelling reason (I had other commands, or I was using it elsewhere).

···

On Thu, Oct 14, 2021 at 8:59 AM Die Optimisten <inform@die-optimisten.net> wrote:

Am 14.10.21 um 17:18 schrieb hmdne:
> Try this:
>
> while (command = gets)
> command = gets.chomp
> break if command.capitalize == 'Stop'
> puts "Hello hello"
> end
> puts "Goodbye"
>
Hi!

#gets only 1 times...

while (command=gets.chomp)
   puts 'song...' #
   break if command.capitalize == 'Stop'
end
puts "Stop was pressed"

# is more or less the same as the solution above.
# I would prefer if there was be only 1 solution (do...while ?), but
there are many many ways how this could be done.

Opti

Hello!
I don't understand why loop is preferred to while (also it's more
internal overhead),
but that may not matter in a loop doing many other things...
Opti

···

Am 14.10.21 um 18:04 schrieb hmdne:

Ruby has a do...while loop:

begin
expression
end while rule

But this syntax is frowned upon and it's preferred to use this syntax:

loop do
expression
break if rule
end

On 10/14/21 17:59, Die Optimisten wrote:

Am 14.10.21 um 17:18 schrieb hmdne:

Try this:

while (command = gets)
command = gets.chomp
break if command.capitalize == 'Stop'
puts "Hello hello"
end
puts "Goodbye"

Hi!

#gets only 1 times...

while (command=gets.chomp)
puts 'song...' #
break if command.capitalize == 'Stop'
end
puts "Stop was pressed"

# is more or less the same as the solution above.
# I would prefer if there was be only 1 solution (do...while ?), but
there are many many ways how this could be done.

Opti

Unsubscribe:
<mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

I think the actual reason for the preference is that 'loop' makes it clear
that it's meant to be an infinite loop, but tail logic requires more
cognitive load for the reader.

That said, it's just style, and use the style that works best for you.

···

On Thu, Oct 14, 2021 at 9:09 AM Die Optimisten <inform@die-optimisten.net> wrote:

Hello!
I don't understand why loop is preferred to while (also it's more
internal overhead),
but that may not matter in a loop doing many other things...
Opti

Am 14.10.21 um 18:04 schrieb hmdne:
> Ruby has a do...while loop:
>
> begin
> expression
> end while rule
>
> But this syntax is frowned upon and it's preferred to use this syntax:
>
> loop do
> expression
> break if rule
> end
>

Consider this table:

expr if false
  if false
 expr
end
  begin
 expr
end if false
expr while false
  while false
 expr
end
  begin
 expr
end while false

You would expect all 3 in the first row to behave the same - and they do.

The second row is tricky, because the third works differently, it's a do..while loop which means that "expr" is evaluated once.

The loop syntax makes it clear.

···

On 10/14/21 18:09, Die Optimisten wrote:

Hello!
I don't understand why loop is preferred to while (also it's more
internal overhead),
but that may not matter in a loop doing many other things...
Opti

Am 14.10.21 um 18:04 schrieb hmdne:

Ruby has a do...while loop:

begin
 expression
end while rule

But this syntax is frowned upon and it's preferred to use this syntax:

loop do
 expression
 break if rule
end

On 10/14/21 17:59, Die Optimisten wrote:

Am 14.10.21 um 17:18 schrieb hmdne:

Try this:

while (command = gets)
 command = gets.chomp
 break if command.capitalize == 'Stop'
 puts "Hello hello"
end
puts "Goodbye"

Hi!

#gets only 1 times...

while (command=gets.chomp)
 puts 'song...'   #
 break if command.capitalize == 'Stop'
end
puts "Stop was pressed"

# is more or less the same as the solution above.
# I would prefer if there was be only 1 solution (do...while ?), but
there are many many ways how this could be done.

Opti

Unsubscribe:
<mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Hi!
If doing a little more programming, it's for sure you will need the
contents of command early or later... :wink:
Opti

For stuff like this, I prefer `until`, so here's how I would do it:

···

until((command = gets.chomp).match(/stop/i))
puts "song"
end
puts"OK, I'll stop"

As said, there are many many ways this could be done. I probably
wouldn't even bother to store in the `command` variable unless there
was a very compelling reason (I had other commands, or I was using it
elsewhere).

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

There's one single issue with this. gets may return nil if it encounters EOF.

···

On 10/14/21 18:05, James Pacheco wrote:

For stuff like this, I prefer `until`, so here's how I would do it:

until((command = gets.chomp).match(/stop/i))
puts "song"
end
puts"OK, I'll stop"

As said, there are many many ways this could be done. I probably wouldn't even bother to store in the `command` variable unless there was a very compelling reason (I had other commands, or I was using it elsewhere).

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Ah! I understand: a way of circumvention:
use loop, so nothing can be wrong, because nobody knows what while...
does exactly...
(and thats why I dislike this Ruby -- too many things that are not
expected. [maybe it's clear, when understanding how it's parsed, but
there're too many too complicated things - as an example of while:
nobody would expect this little difference...
Opti

···

Am 14.10.21 um 18:15 schrieb hmdne:

Consider this table:

expr if false
  if false
expr
end
  begin
expr
end if false
expr while false
  while false
expr
end
  begin
expr
end while false

You would expect all 3 in the first row to behave the same - and they do.

The second row is tricky, because the third works differently, it's a
do..while loop which means that "expr" is evaluated once.

The loop syntax makes it clear.

As with (2), (1) should also be executed - oh, no! :wink: --> it's inconsistent!

(1) begin
expr
end if false

(2) begin
expr
end while false

You're right...

It should probably be gets.to_s.chomps...

It also doesn't address the need to run once. So my solution is definitely
"non ideal".

···

On Thu, Oct 14, 2021 at 9:18 AM hmdne <hmdne@airmail.cc> wrote:

There's one single issue with this. gets may return nil if it encounters
EOF.

On 10/14/21 18:05, James Pacheco wrote:
> For stuff like this, I prefer `until`, so here's how I would do it:
>
> until((command = gets.chomp).match(/stop/i))
> puts "song"
> end
> puts"OK, I'll stop"
>
> As said, there are many many ways this could be done. I probably
> wouldn't even bother to store in the `command` variable unless there
> was a very compelling reason (I had other commands, or I was using it
> elsewhere).
>
> Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org
?subject=unsubscribe>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

I probably wouldn't write this at all, basically. It *feels* like a puzzle
problem, and not real code, so I wouldn't take it seriously enough.

I also tend to over-index on actually creating classes and fully fleshing
out the solution... So I would have some sort of song class which housed
everything... I don't know. I'd have to think harder than my currently
"recovering from illness" brain is capable of at the moment.

···

On Thu, Oct 14, 2021 at 9:17 AM Die Optimisten <inform@die-optimisten.net> wrote:

Hi!
If doing a little more programming, it's for sure you will need the
contents of command early or later... :wink:
Opti

For stuff like this, I prefer `until`, so here's how I would do it:

until((command = gets.chomp).match(/stop/i))
puts "song"
end
puts "OK, I'll stop"

As said, there are many many ways this could be done. I probably wouldn't
even bother to store in the `command` variable unless there was a very
compelling reason (I had other commands, or I was using it elsewhere).

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe> <ruby-talk-request@ruby-lang.org?subject=unsubscribe><http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt; <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

There are a few features that are little known about and may be tricky that it's recommended to never use them if you want to write maintainable code. Even Matz asked politely due to those reasons to never use it. Just like a lot of features we talked about previously on this mailing list - not that those don't have their purpose, because they have, but because you shouldn't use them the way you intend to do.

Actually it's one of the goals of Ruby to never surprise the programmer. And I myself was really surprised only twice in the whole 15 years career of Ruby code writing.

Once when I learned that `sort` works a little differently on Windows (consider this fragment: `%w[mnop a b c def ghi jkl].sort_by(&:length)`)

And a second time when I learned that " " (an empty space String) argument to split is a special case (consider: `"a b c\nd e f".split(" ")`)

Compared to other environments like JavaScript or PHP, which surprise you every day, I would say that's a very good score.

···

On 10/14/21 18:29, Die Optimisten wrote:

Ah! I understand: a way of circumvention:
use loop, so nothing can be wrong, because nobody knows what while... does exactly...
(and thats why I dislike this Ruby -- too many things that are not expected. [maybe it's clear, when understanding how it's parsed, but there're too many too complicated things - as an example of while: nobody would expect this little difference...
Opti

I will leave to others the re-writing of your program, but I thought it would be instructive to point out some mistakes that you made (in the spirit that you only learn from your mistakes).

1) Did you mean "command.capitalize != 'Stop'" instead of "command.capitalize! = 'Stop'". As written, that will generate a syntax error. As has been discussed in this forum recently, white space is significant in Ruby -- the space between the "!" and the "=" completely changes the meaning. Note: the "!" on the end of a method call (e.g. "capitalize!") by convention indicates that the method mutates it's object (e.g. "command.capitalize!", in addition to returning the capitalized version of "command", will change the contents of "command" to it's capitalized version. Not all functions exist in a "!" version, but most do if it would make sense to do so.

2) Calling "gets" twice will ask for input twice; the way you've written it, the program will get a line of input, discard it, and then start the loop where the first thing it does is get a line of input.

3) The outer "if" loop is unnecessary; it is covered by the "while" condition.

···

On Thu, Oct 14, 2021, at 9:05 AM, James Pacheco wrote:

On Thu, Oct 14, 2021 at 8:59 AM Die Optimisten <inform@die-optimisten.net> wrote:

Am 14.10.21 um 17:18 schrieb hmdne:
> Try this:
>
> while (command = gets)
> command = gets.chomp
> break if command.capitalize == 'Stop'
> puts "Hello hello"
> end
> puts "Goodbye"
>
Hi!

#gets only 1 times...

while (command=gets.chomp)
   puts 'song...' #
   break if command.capitalize == 'Stop'
end
puts "Stop was pressed"

# is more or less the same as the solution above.
# I would prefer if there was be only 1 solution (do...while ?), but
there are many many ways how this could be done.

Opti

For stuff like this, I prefer `until`, so here's how I would do it:

until((command = gets.chomp).match(/stop/i))
puts "song"
end
puts "OK, I'll stop"

As said, there are many many ways this could be done. I probably wouldn't even bother to store in the `command` variable unless there was a very compelling reason (I had other commands, or I was using it elsewhere).

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe <mailto:ruby-talk-request@ruby-lang.org%3Fsubject%3Dunsubscribe>>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

It's more you have to learn very much (many things and what they do
really), once knowing that, it's not so hard to use, but it's really
much (too much!)
e.g. what's returned: str.delete vs arr.delete
also str.delete 'ab' is NOT the (sub)string 'ab'; str.delete regex is
NOT available (like grep) - there are many examples.

Perhaps we should first collect these 'strange examples' and then see
(vote?) what should be done (or to leave it as it is)...

Any agreement / suggestions / disagreement ?

Opti

···

Am 14.10.21 um 18:47 schrieb hmdne:

There are a few features that are little known about and may be tricky
that it's recommended to never use them if you want to write
maintainable code. Even Matz asked politely due to those reasons to
never use it. Just like a lot of features we talked about previously
on this mailing list - not that those don't have their purpose,
because they have, but because you shouldn't use them the way you
intend to do.

Actually it's one of the goals of Ruby to never surprise the
programmer. And I myself was really surprised only twice in the whole
15 years career of Ruby code writing.

Once when I learned that `sort` works a little differently on Windows
(consider this fragment: `%w[mnop a b c def ghi jkl].sort_by(&:length)`)

And a second time when I learned that " " (an empty space String)
argument to split is a special case (consider: `"a b c\nd e f".split("
")`)

Compared to other environments like JavaScript or PHP, which surprise
you every day, I would say that's a very good score.

On 10/14/21 18:29, Die Optimisten wrote:

Ah! I understand: a way of circumvention:
use loop, so nothing can be wrong, because nobody knows what while...
does exactly...
(and thats why I dislike this Ruby -- too many things that are not
expected. [maybe it's clear, when understanding how it's parsed, but
there're too many too complicated things - as an example of while:
nobody would expect this little difference...
Opti

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

The problem now is that Ruby is a mature language with a lot of codebase being written in it. Any such corrections would result in incompatibilities which would warrant a major release, like Ruby 4. Thing is, it's not so easy. Take a look at Python 3 - happily now most users migrated to it, but how long it took for them... Same happened with Ruby 1.8 vs Ruby 1.9. It may be simple to port a 1000 line code snippet, but if an entire business logic of a company is written in such a language - porting it may be a work that would take a year or so.

On the other hand, adding a feature like regexp support to str.delete shouldn't be a problem.

···

On 10/14/21 19:02, Die Optimisten wrote:

It's more you have to learn very much (many things and what they do
really), once knowing that, it's not so hard to use, but it's really
much (too much!)
e.g. what's returned: str.delete vs arr.delete
also str.delete 'ab' is NOT the (sub)string 'ab'; str.delete regex is
NOT available (like grep) - there are many examples.

Perhaps we should first collect these 'strange examples' and then see
(vote?) what should be done (or to leave it as it is)...

Any agreement / suggestions / disagreement ?

Opti

Yes, I know.
So it would be a fork (or a different language) - every programmer/team
will then choose which language to use for a (new) project.
So 'old' software will run as before...
Sounds realistic... (there would be too many incompatibilities...)
Opti

···

Am 14.10.21 um 19:12 schrieb hmdne:

The problem now is that Ruby is a mature language with a lot of
codebase being written in it. Any such corrections would result in
incompatibilities which would warrant a major release, like Ruby 4.
Thing is, it's not so easy. Take a look at Python 3 - happily now most
users migrated to it, but how long it took for them... Same happened
with Ruby 1.8 vs Ruby 1.9. It may be simple to port a 1000 line code
snippet, but if an entire business logic of a company is written in
such a language - porting it may be a work that would take a year or so.

On the other hand, adding a feature like regexp support to str.delete
shouldn't be a problem.

On 10/14/21 19:02, Die Optimisten wrote:

It's more you have to learn very much (many things and what they do
really), once knowing that, it's not so hard to use, but it's really
much (too much!)
e.g. what's returned: str.delete vs arr.delete
also str.delete 'ab' is NOT the (sub)string 'ab'; str.delete regex is
NOT available (like grep) - there are many examples.

Perhaps we should first collect these 'strange examples' and then see
(vote?) what should be done (or to leave it as it is)...

Any agreement / suggestions / disagreement ?

Opti