Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.subst-mutate does not return all matches when :x option is used #5702

Closed
p6rt opened this issue Sep 28, 2016 · 3 comments
Closed

.subst-mutate does not return all matches when :x option is used #5702

p6rt opened this issue Sep 28, 2016 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 28, 2016

Migrated from rt.perl.org#129596 (status was 'resolved')

Searchable as RT129596$

@p6rt
Copy link
Author

p6rt commented Sep 28, 2016

From @zoffixznet

# I have the fix; filing for records

The .subst-mutate routine returns a Match object (or Nil) on singular operations or a List of Match objects when :g/​:global is used, as that produces several matches.

The :x option also produces several matches​:

m​: say "1234567".match​: /\d/, :x(5)
rakudo-moar c01fc3​: OUTPUT«(「1」 「2」 「3」 「4」 「5」)␤

However, only a single match object is returned when that option is used with .subst-mutate, even though the option does have the desired effect on the substitutions​:

m​: my $x = "1234567"; say $x.subst-mutate​: /\d/, '', :x(5); say $x
rakudo-moar c01fc3​: OUTPUT«「1」␤67␤»

@p6rt
Copy link
Author

p6rt commented Sep 28, 2016

From @zoffixznet

Fixed in rakudo/rakudo@f6524e61e8
Tests added in Raku/roast@391ecba7b9

On Wed Sep 28 06​:02​:48 2016, cpan@​zoffix.com wrote​:

# I have the fix; filing for records

The .subst-mutate routine returns a Match object (or Nil) on singular
operations or a List of Match objects when :g/​:global is used, as that
produces several matches.

The :x option also produces several matches​:

m​: say "1234567".match​: /\d/, :x(5)
rakudo-moar c01fc3​: OUTPUT«(「1」 「2」 「3」 「4」 「5」)␤

However, only a single match object is returned when that option is
used with .subst-mutate, even though the option does have the desired
effect on the substitutions​:

m​: my $x = "1234567"; say $x.subst-mutate​: /\d/, '', :x(5); say $x
rakudo-moar c01fc3​: OUTPUT«「1」␤67␤»

@p6rt
Copy link
Author

p6rt commented Sep 28, 2016

@zoffixznet - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Sep 28, 2016
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant