This is what I have so far.
my $x=" 1.2.3.4:12345 "; $x = $x.trim; $x~~s/(.*'.')
.*/$0$(Q[0/24])/; say "<$x>";
<1.2.3.0/24>
It works. Is there a way to petty it up with ^ and $ ?
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 rep
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 p
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 (no
On 09/15/2018 07:32 PM, Larry Wall wrote:
On Sat, Sep 15, 2018 at 06:45:33PM -0700, ToddAndMargo wrote:
: Hi All,
:
: I have been doing a bunch with regex's lately.
: I just throw them out based on prior experience
: and they most all work now. I only sometimes have to
: ask for help. (The look
On Sat, Sep 15, 2018 at 06:45:33PM -0700, ToddAndMargo wrote:
: Hi All,
:
: I have been doing a bunch with regex's lately.
: I just throw them out based on prior experience
: and they most all work now. I only sometimes have to
: ask for help. (The look forward () feature
: is sweet.)
:
: Anywa
On 08/02/2018 09:43 AM, Arthur Ramos Jr. wrote:
This works too:
my $x = "9.0v1"; die "Horribly" if $x =~ /[\p{L}]+/;
Art
Perl 5 by chance (=~)? Or am I missing something?
On Thu, Aug 2, 2018 at 8:18 AM Timo Paulssen wrote:
> Is this what you want?
>
> perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/'
> 「12345」
>
> perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/'
> Nil
On Sun, Aug 5, 2018 at 6:41 PM Arthur Ramos Jr.
wrote:
> my $x = "9.0v1"; die "Horribly" if $x =~
This works too:
my $x = "9.0v1"; die "Horribly" if $x =~ /[\p{L}]+/;
Art
On Thu, Aug 2, 2018 at 8:18 AM Timo Paulssen wrote:
> Is this what you want?
>
> perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/'
> 「12345」
>
> perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/'
> Nil
>
> HTH
> - Timo
>
--
On 08/03/2018 11:36 AM, Parrot Raiser wrote:
If I've interpreted this
https://docs.perl6.org/language/regexes#Enumerated_character_classes_and_ranges
correctly,
^ is "start of string"
+alnum means "in the alphanumeric set"
-alpha means "not in the purely alphabetic set"
i.e. <+alnum -alpha> me
On 08/03/2018 11:52 AM, Patrick R. Michaud wrote:
The + essentially indicates that this is a character-class match. It's to distinguish things from
<.alpha>, , , <-alpha>, and (among others).
Thank you!
On 08/03/2018 11:48 AM, Timo Paulssen wrote:
The + is required, perhaps because the first character after the opening
< is supposed to determine exactly what thing it is? Not sure about
that. The + and - is a bit like "start at nothing, add all alnums, then
subtract all alphas". The + after the <
The + essentially indicates that this is a character-class match. It's to
distinguish things from <.alpha>, , , <-alpha>, and
(among others).
Pm
On Fri, Aug 03, 2018 at 08:48:24PM +0200, Timo Paulssen wrote:
> The + is required, perhaps because the first character after the opening
> < is sup
The + is required, perhaps because the first character after the opening
< is supposed to determine exactly what thing it is? Not sure about
that. The + and - is a bit like "start at nothing, add all alnums, then
subtract all alphas". The + after the < > is just to match it any number
of times, but
That document also says that _ is considered a letter (that is, is matched
by :
https://docs.perl6.org/language/regexes#Predefined_Character_Classes), so
that's the same thing as . I observed that earlier as well.
On Fri, Aug 3, 2018 at 2:37 PM Parrot Raiser <1parr...@gmail.com> wrote:
> If I've
If I've interpreted this
https://docs.perl6.org/language/regexes#Enumerated_character_classes_and_ranges
correctly,
^ is "start of string"
+alnum means "in the alphanumeric set"
-alpha means "not in the purely alphabetic set"
i.e. <+alnum -alpha> means "alphanumeric but not a letter", i.e 0-9_
+
On 08/02/2018 05:18 AM, Timo Paulssen wrote:
Is this what you want?
perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/'
「12345」
perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/'
Nil
HTH
- Timo
What does the following do?
+alnum (why does it need the "+"?)
-alpha (I presume "-" me
On 08/02/2018 05:18 AM, Timo Paulssen wrote:
Is this what you want?
perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/'
「12345」
perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/'
Nil
HTH
- Timo
A piece of art. Thank you!
Is this what you want?
perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/'
「12345」
perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/'
Nil
HTH
- Timo
Set operations seem to be unsupported on predefined character classes (or
subrules). (Or, if they are supported, I don't know what the right syntax
might be.)
Set operations seem to work properly, though, with escaped character
classes. For example:
perl6 -e 'my $x = "9.0v1"; say so $x ~~ /<[\w]
\d and both match Unicode characters as well.
If that's not the intention then it's best to be explicit.
die("Horribly") unless "9.b1" ~~ / <[0-9]+> % '.' /;
Typing from my phone so unable to test the above***
On Thu, Aug 2, 2018, 12:56 AM ToddAndMargo wrote:
> Hi All,
>
> If there are any l
On 08/01/2018 10:00 PM, Brandon Allbery wrote:
Set operations have to be inside the <>. You want something like:
/<[alnum-alpha]>/.
That said, this would be the same as //, I think? Please describe
in words what you intended with that regex. (I suspect /<[alpha]>/ is
what you really want, bas
Set operations have to be inside the <>. You want something like:
/<[alnum-alpha]>/.
That said, this would be the same as //, I think? Please describe in
words what you intended with that regex. (I suspect /<[alpha]>/ is what you
really want, based on your earlier statement.)
On Thu, Aug 2, 2018
23 matches
Mail list logo