Re: How do I remove leading zeros?

2018-06-13 Thread Brandon Allbery
https://docs.perl6.org/language/regexes#Capture_markers:_%3C(_)%3E On Wed, Jun 13, 2018 at 3:10 PM Xin Cheng wrote: > Now we know the meaning of >> and <<. But what about <( and )> ? What do > they mean here? > > Thanks. > Xin > > On Jun 13, 2018, at 2:18 PM, Brad Gilbert wrote: > > On Wed,

Re: How do I remove leading zeros?

2018-06-13 Thread Xin Cheng
Now we know the meaning of >> and <<. But what about <( and )> ? What do they mean here? Thanks. Xin > On Jun 13, 2018, at 2:18 PM, Brad Gilbert wrote: > > On Wed, Jun 13, 2018 at 1:09 PM ToddAndMargo > wrote: >> >> On 06/13/2018 11:06 AM, ToddAndMargo wrote:

Re: How do I remove leading zeros?

2018-06-13 Thread ToddAndMargo
On 06/13/2018 11:18 AM, Brad Gilbert wrote: On Wed, Jun 13, 2018 at 1:09 PM ToddAndMargo wrote: On 06/13/2018 11:06 AM, ToddAndMargo wrote: On 06/13/2018 11:03 AM, ToddAndMargo wrote: On 06/13/2018 11:00 AM, Larry Wall wrote: $ p6 'my $x = "01.000.103.006.10"; $x ~~ s:g/«0+)>\d//;

Re: How do I remove leading zeros?

2018-06-13 Thread Brad Gilbert
On Wed, Jun 13, 2018 at 1:09 PM ToddAndMargo wrote: > > On 06/13/2018 11:06 AM, ToddAndMargo wrote: > > On 06/13/2018 11:03 AM, ToddAndMargo wrote: > >> On 06/13/2018 11:00 AM, Larry Wall wrote: > > > $ p6 'my $x = "01.000.103.006.10"; $x ~~ s:g/«0+)>\d//; say "$x"' > > 1.0.103.6.10 > >

Re: How do I remove leading zeros?

2018-06-13 Thread Brandon Allbery
https://docs.perl6.org/language/unicode_entry I have right Alt set as my Compose key, so it'd be [right-Alt] < < (At some point I should see if I can put in some information about WinCompose, since I think I'm currently the only one with any experience with it.) On Wed, Jun 13, 2018 at 2:09 PM

Re: How do I remove leading zeros?

2018-06-13 Thread ToddAndMargo
On 06/13/2018 11:06 AM, ToddAndMargo wrote: On 06/13/2018 11:03 AM, ToddAndMargo wrote: On 06/13/2018 11:00 AM, Larry Wall wrote:    $ p6 'my $x = "01.000.103.006.10"; $x ~~ s:g/«0+)>\d//; say "$x"'    1.0.103.6.10 Hi Larry, How did you get thee "«" character to appear? And what

Re: How do I remove leading zeros?

2018-06-13 Thread ToddAndMargo
On 06/13/2018 11:03 AM, ToddAndMargo wrote: On 06/13/2018 11:00 AM, Larry Wall wrote: I'd probably just write something like: s:g { « <( 0+ )> \d+ » } = ''; The first <( and the last » are not strictly necessary, but add clarity, or at least balance.  But in golf mode you could get away

Re: How do I remove leading zeros?

2018-06-13 Thread ToddAndMargo
On 06/13/2018 11:00 AM, Larry Wall wrote: I'd probably just write something like: s:g { « <( 0+ )> \d+ » } = ''; The first <( and the last » are not strictly necessary, but add clarity, or at least balance. But in golf mode you could get away with something like: sg/«0+)>\d//;

Re: How do I remove leading zeros?

2018-06-13 Thread ToddAndMargo
On 06/12/2018 10:22 PM, Norman Gaywood wrote: On Wed, 13 Jun 2018 at 14:57, ToddAndMargo > wrote: I am trying to turn      01.02.03 into      1.2.3 What am I doing wrong, this time? $ p6 'my $x="01.02.03"; $x ~~ s:global/"0"(\d)/ $0

Re: How do I remove leading zeros?

2018-06-13 Thread Larry Wall
I'd probably just write something like: s:g { « <( 0+ )> \d+ » } = ''; The first <( and the last » are not strictly necessary, but add clarity, or at least balance. But in golf mode you could get away with something like: sg/«0+)>\d//; Larry

Re: How do I remove leading zeros?

2018-06-13 Thread Mark Senn
If $x is set to "01.02.03" (Not using normal message quoting to make message shorter. [1] ToddAndMargo[2] Norman Gaywood[3] Mark Senn) DOING $x ~~ s:global/"0"(\d)/ $0 /; [1] SETS $x TO"1 . 2 . 3"[1]

Re: How do I remove leading zeros?

2018-06-12 Thread ToddAndMargo
On 06/12/2018 09:56 PM, ToddAndMargo wrote: Hi All, I am trying to turn     01.02.03 into     1.2.3 What am I doing wrong, this time? $ p6 'my $x="01.02.03"; $x ~~ s:global/"0"(\d)/ $0 /; say "$x"'  1 . 2 . 3 Many thanks, -T Got it: $ p6 'my $x = "01.0.3.06.10"; say

Re: How do I remove leading zeros?

2018-06-12 Thread Norman Gaywood
On Wed, 13 Jun 2018 at 14:57, ToddAndMargo wrote: > I am trying to turn > > 01.02.03 > > into > > 1.2.3 > > What am I doing wrong, this time? > > $ p6 'my $x="01.02.03"; $x ~~ s:global/"0"(\d)/ $0 /; say "$x"' > 1 . 2 . 3 > > The second part of the s/// operator is a string (spaces

How do I remove leading zeros?

2018-06-12 Thread ToddAndMargo
Hi All, I am trying to turn 01.02.03 into 1.2.3 What am I doing wrong, this time? $ p6 'my $x="01.02.03"; $x ~~ s:global/"0"(\d)/ $0 /; say "$x"' 1 . 2 . 3 Many thanks, -T -- ~ When we ask for advice, we are