On Sat, Oct 29, 2022 at 7:29 PM ToddAndMargo via perl6-users <
perl6-us...@perl.org> wrote:
> >> On Sat, Oct 29, 2022 at 6:46 PM ToddAndMargo via perl6-users
> >> mailto:perl6-us...@perl.org>> wrote:
> >>
> >> Hi All,
> >>
> >> With a regex, how do I pick out items in the middle of the str
On Sat, Oct 29, 2022 at 6:46 PM ToddAndMargo via perl6-users
mailto:perl6-us...@perl.org>> wrote:
Hi All,
With a regex, how do I pick out items in the middle of the string? Two
from the beginning or two from the end?
4] > my Str $y="xx"; $y ~~ s/ $([.*-2]) "x"/Q/; print $
In the Raku REPL:
$ raku
Welcome to Rakudo™ v2022.07.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2022.07.
To exit type 'exit' or '^D'
[0] > #beginning
Nil
[1] > my Str $y="xx"; S/^ x ** 2 /QQ/.say given $y;
QQ
[1] > #inner
Nil
[2] > my Str $y="xx"; S/^ [
Hi All,
With a regex, how do I pick out items in the middle of the string? Two
from the beginning or two from the end?
4] > my Str $y="xx"; $y ~~ s/ $([.*-2]) "x"/Q/; print $y ~ "\n"
===SORRY!=== Error while compiling:
Malformed postfix call
--> my Str $y="xx"; $y ~~ s/ $([.*⏏-2
On 10/29/22 14:28, ToddAndMargo via perl6-users wrote:
On 10/29/22 13:07, Elizabeth Mattijsen wrote:
> $ echo "a/b/c/d" | raku -ne 'say .subst("/", Q/\\\/, :g)'
>
Hi Elizabeth,
Thank you for the subst workaround!
I created a keep of the subst. Got to
love Raku. 101 ways of doing everything
On 10/29/22 13:02, ToddAndMargo via perl6-users wrote:
Hi All,
I am trying to change
/
into
\\\
This works:
$ echo "a/b/c/d" | raku -ne 'my $x=$_; $x~~s:g|$(Q[/])|\\|;print $x
~ "\n"'
a\\\b\\\c\\\d
But this does not:
$ echo "a/b/c/d" | raku -ne 'my $x=$_; $x~~s:g|$(Q[/
On 29 Oct 2022, at 23:28, ToddAndMargo via perl6-users
wrote:
On 29 Oct 2022, at 22:02, ToddAndMargo via perl6-users
wrote:
Hi All,
I am trying to change
/
into
\\\
This works:
$ echo "a/b/c/d" | raku -ne 'my $x=$_; $x~~s:g|$(Q[/])|\\|;print $x ~ "\n"'
a\\\b\\\c\\\d
/ 'literal string in target' /
> On 29 Oct 2022, at 23:28, ToddAndMargo via perl6-users
> wrote:
>
>
>>> On 29 Oct 2022, at 22:02, ToddAndMargo via perl6-users
>>> wrote:
>>>
>>> Hi All,
>>>
>>> I am trying to change
>>>
>>> /
>>>
>>> into
>>>
>>> \\\
>>>
>>> This works:
>>>
>
On 29 Oct 2022, at 22:02, ToddAndMargo via perl6-users
wrote:
Hi All,
I am trying to change
/
into
\\\
This works:
$ echo "a/b/c/d" | raku -ne 'my $x=$_; $x~~s:g|$(Q[/])|\\|;print $x ~ "\n"'
a\\\b\\\c\\\d
But this does not:
$ echo "a/b/c/d" | raku -ne 'my $x=$_; $x~~s
$ echo "a/b/c/d" | raku -ne 'say .subst("/", Q/\\\/, :g)'
> On 29 Oct 2022, at 22:02, ToddAndMargo via perl6-users
> wrote:
>
> Hi All,
>
> I am trying to change
>
> /
>
> into
>
> \\\
>
> This works:
>
>
> $ echo "a/b/c/d" | raku -ne 'my $x=$_; $x~~s:g|$(Q[/])|\\|;print $x ~
Hi All,
I am trying to change
/
into
\\\
This works:
$ echo "a/b/c/d" | raku -ne 'my $x=$_; $x~~s:g|$(Q[/])|\\|;print $x
~ "\n"'
a\\\b\\\c\\\d
But this does not:
$ echo "a/b/c/d" | raku -ne 'my $x=$_; $x~~s:g|$(Q[/])|Q[\\\]|;print $x
~ "\n"'
aQ[\]bQ[\]cQ[\]d
How do I
11 matches
Mail list logo