On 4/29/24 17:42, ToddAndMargo via perl6-users wrote:
Hi All,

I thought I understood ^ and ? used in a regex'es,
but I don't.

^ means from the beginning and ? from the end.

I am trying to put together an example
of how to use them:

I have

    1.2.3.4

I want
    1.2.3.0/24

So Far I have (not working):

    raku -e 'my $x="1.2.3.4"; $x~~s/ (.*) $(Q[.]) /$0Q[0/24]/; say $x;'

How do I do this with ^ and $  ?

Many thanks,
-T


raku -e 'my $x="1.2.3.4"; $x~~s/ (.*) $(Q[.]) /$0$(Q[0.24])/; say $x;'
1.2.30.244



Reply via email to