Re: Need regex ^? help

[email protected] (ToddAndMargo via perl6-users)
Newsgroups perl.perl6.users
Message-ID <[email protected]>
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 replaces them with the string "0/24".  Everything prior to those digits is left alone.
> 
> On Mon, Apr 29, 2024 at 05:45:49PM -0700, ToddAndMargo via perl6-users wrote:
>> 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 think you mean "$" here instead of "?".
> 
> Pm


Oh I did figure it out another way.  I am trying to
get a working example of ^ and $ for my Redex
keeper file
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.