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
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
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
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/ (.*)
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
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.)
:
:
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.)
Anyway, I have been using regex switches without
knowing why. So
What is the
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>
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
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,
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 "-"
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
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,
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
Hi All,
If there are any letter in the string, I want it to fail
$ p6 'my $x="9.0v1"; if $x~~/<+alnum>-[]>/ {say "Y";}'
===SORRY!===
Unrecognized regex metacharacter - (must be quoted to match literally)
at -e:1
--> my $x="9.0v1"; if $x~~/<+alnum>⏏-[]>/ {say "Y";}
Unable to parse regex;
On 05/11/2018 02:03 AM, Steve Mynott wrote:
There is a perl 5 compatible option you can pass to perl 6 regexps.
Not sure its 100% and I think it's based on perl5.10 but it could be useful
if you wanted to gradually port perl 5 to perl 6.
I am going to figure it out if it kills me!
On 05/10/2018 09:26 PM, ToddAndMargo wrote:
On 05/10/2018 09:13 PM, ToddAndMargo wrote:
On Thu, May 10, 2018 at 11:56 PM, ToddAndMargo
> wrote:
Hi All,
I am trying to convert this over from Perl5:
P5:
$dir_entry =~
On 05/10/2018 09:13 PM, ToddAndMargo wrote:
On Thu, May 10, 2018 at 11:56 PM, ToddAndMargo > wrote:
Hi All,
I am trying to convert this over from Perl5:
P5:
$dir_entry =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;
On Thu, May 10, 2018 at 11:56 PM, ToddAndMargo > wrote:
Hi All,
I am trying to convert this over from Perl5:
P5:
$dir_entry =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;
P6:
$dir_entry ~~
Pretty much what it's telling you. Instead of the numbers in braces, it's
the ** operator with a range after it: \d ** 1..4
(Remember that spaces do nothing in a P6 regex, so you can use them for
readability or to separate the range from what follows, etc.)
On Thu, May 10, 2018 at 11:56 PM,
Hi All,
I am trying to convert this over from Perl5:
P5:
$dir_entry =~ /.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*${Extension}/;
P6:
$dir_entry ~~ m/.*?(\d{1,4}\D\d{1,4}\D\d{1,4}).*{$Extension}/;
$ perl6 -c GetUpdates.pl6
===SORRY!===
Unsupported use of {N,M} as general quantifier; in Perl 6
32 matches
Mail list logo