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

Potential regular expression issue #5026

Closed
p6rt opened this issue Jan 9, 2016 · 7 comments
Closed

Potential regular expression issue #5026

p6rt opened this issue Jan 9, 2016 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Jan 9, 2016

Migrated from rt.perl.org#127220 (status was 'rejected')

Searchable as RT127220$

@p6rt
Copy link
Author

p6rt commented Jan 9, 2016

From @drforr

jgoff@​Demeisen​:~$ perl6 -v
This is Rakudo version 2015.12-152-gd7f3f0b built on MoarVM version
2015.12-29-g8079ca5
implementing Perl 6.c.

The following is a simple script that changes newlines to their control
picture equivalent, or at least it should​:

--cut here--
my $str = "foo\nbar";
$str ~~ s​:g/\n/\c[2424]/;
say $str;
--cut here--

And here's the output​:

--cut here--
jgoff@​Demeisen​:~$ perl6 -I. bug.txt | hexdump -C
00000000 66 6f 6f e0 a5 b8 62 61 72 0a |foo...bar.|
0000000a
--cut here--

The s/// statement turns newlines into E0 A5 B8, which is U+0978
DEVANAGARI LETTER MARWARI DDA and not E2 90 A4, which is U+2424 SYMBOL
FOR NEWLINE. The 0A at the end of the string is unaffected, as it should
be.

@p6rt
Copy link
Author

p6rt commented Jan 9, 2016

From @drforr

Please close this, I was being an idiot. \c[0x2424] - I just blithely
assumed that the number was as in \x{..}.

On 2016-01-09 10​:33, perl6 via RT wrote​:

Greetings,

This message has been automatically generated in response to the
creation of a trouble ticket regarding​:
"Potential regular expression issue",
a summary of which appears below.

There is no need to reply to this message right now. Your ticket has
been
assigned an ID of [perl #​127220].

Please include the string​:

     \[perl #​127220\]

in the subject line of all future correspondence about this issue. To
do so,
you may reply to this message.

                    Thank you,
                    perl6\-bugs\-followup@​perl\.org

-------------------------------------------------------------------------
jgoff@​Demeisen​:~$ perl6 -v
This is Rakudo version 2015.12-152-gd7f3f0b built on MoarVM version
2015.12-29-g8079ca5
implementing Perl 6.c.

The following is a simple script that changes newlines to their control
picture equivalent, or at least it should​:

--cut here--
my $str = "foo\nbar";
$str ~~ s​:g/\n/\c[2424]/;
say $str;
--cut here--

And here's the output​:

--cut here--
jgoff@​Demeisen​:~$ perl6 -I. bug.txt | hexdump -C
00000000 66 6f 6f e0 a5 b8 62 61 72 0a
|foo...bar.|
0000000a
--cut here--

The s/// statement turns newlines into E0 A5 B8, which is U+0978
DEVANAGARI LETTER MARWARI DDA and not E2 90 A4, which is U+2424 SYMBOL
FOR NEWLINE. The 0A at the end of the string is unaffected, as it
should
be.

@p6rt
Copy link
Author

p6rt commented Jan 9, 2016

From @lizmat

On 09 Jan 2016, at 10​:33, (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by
# Please include the string​: [perl #​127220]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127220 >

jgoff@​Demeisen​:~$ perl6 -v
This is Rakudo version 2015.12-152-gd7f3f0b built on MoarVM version
2015.12-29-g8079ca5
implementing Perl 6.c.

The following is a simple script that changes newlines to their control
picture equivalent, or at least it should​:

--cut here--
my $str = "foo\nbar";
$str ~~ s​:g/\n/\c[2424]/;
say $str;
--cut here--

And here's the output​:

--cut here--
jgoff@​Demeisen​:~$ perl6 -I. bug.txt | hexdump -C
00000000 66 6f 6f e0 a5 b8 62 61 72 0a |foo...bar.|
0000000a
--cut here--

The s/// statement turns newlines into E0 A5 B8, which is U+0978
DEVANAGARI LETTER MARWARI DDA and not E2 90 A4, which is U+2424 SYMBOL
FOR NEWLINE. The 0A at the end of the string is unaffected, as it should
be.

\c[] interpretes codepoint values in decimal, not hexadecimal. If you use the correct decimal value​:

$ 6 'say "\x2424".ord’
9252

you get​:

$ 6 'my $a = "aa\nbb"; $a ~~ s​:g/\n/\c[9252]/; say $a'
aa␤bb

In my opinion, ENOTABUG and can therefore can be closed.

@p6rt
Copy link
Author

p6rt commented Jan 9, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 9, 2016

From @drforr

On 2016-01-09 12​:19, Elizabeth Mattijsen via RT wrote​:

On 09 Jan 2016, at 10​:33, (via RT) <perl6-bugs-followup@​perl.org>
wrote​:

Yeah, about as soon as I sent it in I realized what I'd done wrong.
Expectations from P5 getting in the way.

# New Ticket Created by
# Please include the string​: [perl #​127220]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=127220 >

jgoff@​Demeisen​:~$ perl6 -v
This is Rakudo version 2015.12-152-gd7f3f0b built on MoarVM version
2015.12-29-g8079ca5
implementing Perl 6.c.

The following is a simple script that changes newlines to their
control
picture equivalent, or at least it should​:

--cut here--
my $str = "foo\nbar";
$str ~~ s​:g/\n/\c[2424]/;
say $str;
--cut here--

And here's the output​:

--cut here--
jgoff@​Demeisen​:~$ perl6 -I. bug.txt | hexdump -C
00000000 66 6f 6f e0 a5 b8 62 61 72 0a
|foo...bar.|
0000000a
--cut here--

The s/// statement turns newlines into E0 A5 B8, which is U+0978
DEVANAGARI LETTER MARWARI DDA and not E2 90 A4, which is U+2424 SYMBOL
FOR NEWLINE. The 0A at the end of the string is unaffected, as it
should
be.

\c[] interpretes codepoint values in decimal, not hexadecimal. If you
use the correct decimal value​:

$ 6 'say "\x2424".ord’
9252

you get​:

$ 6 'my $a = "aa\nbb"; $a ~~ s​:g/\n/\c[9252]/; say $a'
aa␤bb

In my opinion, ENOTABUG and can therefore can be closed.

@p6rt
Copy link
Author

p6rt commented Jan 9, 2016

From @usev6

As requested, I'm closing this ticket.

@p6rt p6rt closed this as completed Jan 9, 2016
@p6rt
Copy link
Author

p6rt commented Jan 9, 2016

@usev6 - Status changed from 'open' to 'rejected'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant