Re: Need regex ^? help

2024-04-29 Thread ToddAndMargo via perl6-users
On 4/29/24 17:57, Patrick R. Michaud wrote: Perhaps not really what you're intending, but here's how I'd start: $ raku -e 'my $x="1.2.3.4"; $x ~~ s!\d+$!0/24!; say $x;' 1.2.3.0/24 The pattern part of the substitution matches all of the digits at the end of the string (\d+$), then

Re: Need regex ^? help

2024-04-29 Thread Patrick R. Michaud
Perhaps not really what you're intending, but here's how I'd start: $ raku -e 'my $x="1.2.3.4"; $x ~~ s!\d+$!0/24!; say $x;' 1.2.3.0/24 The pattern part of the substitution matches all of the digits at the end of the string (\d+$), then replaces them with the string "0/24". Everything

Re: Need regex ^? help

2024-04-29 Thread ToddAndMargo via perl6-users
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

Need regex ^? help

2024-04-29 Thread ToddAndMargo via perl6-users
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/ (.*)