Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #36683 > unrolled thread

Remove all lines where first character is not a digit.

Started byJonas Thörnvall <jonas.thornvall@gmail.com>
First post2019-05-30 13:41 -0700
Last post2019-06-01 02:44 -0700
Articles 20 on this page of 26 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-30 13:41 -0700
    Re: Remove all lines where first character is not a digit. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-31 00:05 +0200
      Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-30 23:18 -0700
        Re: Remove all lines where first character is not a digit. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-31 09:10 +0200
      Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-30 23:38 -0700
        Re: Remove all lines where first character is not a digit. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-31 09:17 +0200
          Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-31 00:25 -0700
            Re: Remove all lines where first character is not a digit. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-31 09:39 +0200
              Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-31 04:47 -0700
              Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-31 04:55 -0700
                Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-31 05:01 -0700
                Re: Remove all lines where first character is not a digit. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-31 15:43 +0200
                  Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-31 09:16 -0700
                    Re: Remove all lines where first character is not a digit. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-01 00:29 +0200
                      Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 00:07 -0700
                        Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 00:22 -0700
                        Re: Remove all lines where first character is not a digit. Luuk <luuk@invalid.lan> - 2019-06-01 09:45 +0200
                          Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 00:53 -0700
                            Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 01:01 -0700
                          Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 01:55 -0700
                            Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 02:14 -0700
                          Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 02:38 -0700
          Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-05-31 00:35 -0700
            Re: Remove all lines where first character is not a digit. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-31 09:41 +0200
    Re: Remove all lines where first character is not a digit. JJ <jj4public@vfemail.net> - 2019-06-01 15:29 +0700
      Re: Remove all lines where first character is not a digit. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-01 02:44 -0700

Page 1 of 2  [1] 2  Next page →


#36683 — Remove all lines where first character is not a digit.

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-05-30 13:41 -0700
SubjectRemove all lines where first character is not a digit.
Message-ID<9ff34af1-9e27-4f78-b686-990dcea4371d@googlegroups.com>
Abank[current].replace(/^\s*[\r]/gm,"");

Well this remove something else.

But i saw someone saying that this should remove and line not starting with digit?
^[^0-9].*

It did not say what language regexp or engine the expression was for.

But how can i apply the ^[^0-9].* to do a replace like string at top.

[toc] | [next] | [standalone]


#36684

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-05-31 00:05 +0200
Message-ID<XnsAA60EA3F293eejj99@194.109.6.166>
In reply to#36683
<jonas.thornvall@gmail.com> wrote on 30 May 2019 in comp.lang.javascript: 

> Abank[current].replace(/^\s*[\r]/gm,"");
> 
> Well this remove something else.
> 
> But i saw someone saying that this should remove and line not starting
> with digit? ^[^0-9].*
> 
> It did not say what language regexp or engine the expression was for.
> 
> But how can i apply the ^[^0-9].* to do a replace like string at top.

let source = "1 qwerty\n2 asdfg\nqweeee\n4 z"
let result = source.replace(/^[^0-9].*\n/gm, '');

PLEASE for your own good, analyze this, not just use it!


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#36687

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-05-30 23:18 -0700
Message-ID<475c9700-1982-4295-8d95-0b9bbdc299d2@googlegroups.com>
In reply to#36684
Den fredag 31 maj 2019 kl. 00:05:31 UTC+2 skrev Evertjan.:
> <jonas.thornvall@gmail.com> wrote on 30 May 2019 in comp.lang.javascript: 
> 
> > Abank[current].replace(/^\s*[\r]/gm,"");
> > 
> > Well this remove something else.
> > 
> > But i saw someone saying that this should remove and line not starting
> > with digit? ^[^0-9].*
> > 
> > It did not say what language regexp or engine the expression was for.
> > 
> > But how can i apply the ^[^0-9].* to do a replace like string at top.
> 
> let source = "1 qwerty\n2 asdfg\nqweeee\n4 z"
> let result = source.replace(/^[^0-9].*\n/gm, '');
> 
> PLEASE for your own good, analyze this, not just use it!
> 
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

To be honest Jan there is notthing to analyse, it is just a rather contrieved shortsyntax a bit like hieroglyphs. If i had made regexp it probably would had made sense for anyone looking at the expression. 

Well i can see that see that we look for any value between 0 and 9, i can only guess that ^/ means we are at char 1, "could been done better" i think you also have something about newline in there and /gm "have no idea.

But my analyse and conclusion is, i could do a beter semantic for regexp, one that possibly would "be a bit longer to write out". But people had no problem what so ever to decode. Because for this one you need a lookup table LoL

"Honestly Everjan i really could make something better, and i think it would be much more general using far fewer syntactical elements, and in my regexp the *hieroglyphs* actually would made sense"

That aside i understand that regexp was created during a time when the resources on a computer were in short, and one wanted to save space "but that argument does not hold when you implement something like this today". But maybe one wanted to keep it simple for people that once learned SED under unix. But is that really a valid argument?

[toc] | [prev] | [next] | [standalone]


#36689

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-05-31 09:10 +0200
Message-ID<XnsAA605D6545271eejj99@194.109.6.166>
In reply to#36687
<jonas.thornvall@gmail.com> wrote on 31 May 2019 in comp.lang.javascript: 

> To be honest Jan there is notthing to analyse, it is just a rather
> contrieved shortsyntax a bit like hieroglyphs. 

Dear Thomas Bornsmall,

My name is not Jan, please don't insult me.

Your self-declared honestness equals Trump's,
as is your spelling of 'nothing'.

You are rather acting like a stubborn child, 
not yet understanding that learning is not only necessary, 
but actually fun too.

What is your expertise of hieroglyphics b.t.w., 
is there nothing to learn there for you too?

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#36688

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-05-30 23:38 -0700
Message-ID<dff7187f-281f-4b66-9f18-7831ab1c993a@googlegroups.com>
In reply to#36684
Den fredag 31 maj 2019 kl. 00:05:31 UTC+2 skrev Evertjan.:
> <jonas.thornvall@gmail.com> wrote on 30 May 2019 in comp.lang.javascript: 
> 
> > Abank[current].replace(/^\s*[\r]/gm,"");
> > 
> > Well this remove something else.
> > 
> > But i saw someone saying that this should remove and line not starting
> > with digit? ^[^0-9].*
> > 
> > It did not say what language regexp or engine the expression was for.
> > 
> > But how can i apply the ^[^0-9].* to do a replace like string at top.
> 
> let source = "1 qwerty\n2 asdfg\nqweeee\n4 z"
> let result = source.replace(/^[^0-9].*\n/gm, '');
> 
> PLEASE for your own good, analyze this, not just use it!
> 
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

I just tried it i don't think it work the ; "line"
and the --------- line still there at end of last bank N364 combi D

Note that Abank[current] is basicly a string "textblock" holding the instruments of bank, with linebreaks but also a  "footer?" looking like this, that i want removed.
;
--------------------------------------------------------------

function ListBankInstruments(current){
	//REMOVE LINES NOT STARTING WITH DIGIT
	Abank[current] = Abank[current].replace(/^[^0-9].*\n/gm,""); 
	//REMOVE EMPTY LINES FROM BANK
	Abank[current]=Abank[current].replace(/^\s*[\r]/gm,""); 
	//SPLIT BANK INTO ARRAY OF INSTRUMENTS
	instName=Abank[current].split("\n");
	//REMOVE FIRST LINE "BANKNAME"
	instName.shift();
	//alert(instName);
	instOptionList();
}

[toc] | [prev] | [next] | [standalone]


#36690

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-05-31 09:17 +0200
Message-ID<XnsAA605E7E09959eejj99@194.109.6.166>
In reply to#36688
=?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 31 May 
2019 in comp.lang.javascript:

> I just tried it i don't think it work the ; "line"
> and the --------- line still there at end of last bank N364 combi D

See, you are using code you don't understand!

I warned you against that, 
specifying that my code was for learning and understanding, 
not for blind application. 

However you may be quite right in your assessment,
that you don't think. 

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#36692

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-05-31 00:25 -0700
Message-ID<a13bb842-1ffd-46f8-930f-bf3901ea5c55@googlegroups.com>
In reply to#36690
Den fredag 31 maj 2019 kl. 09:17:42 UTC+2 skrev Evertjan.:
> =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 31 May 
> 2019 in comp.lang.javascript:
> 
> > I just tried it i don't think it work the ; "line"
> > and the --------- line still there at end of last bank N364 combi D
> 
> See, you are using code you don't understand!
> 
> I warned you against that, 
> specifying that my code was for learning and understanding, 
> not for blind application. 
> 
> However you may be quite right in your assessment,
> that you don't think. 
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Well i do not fancy decoding "new age hieroglyphs", i prefer some with a mystery behind. Not something a halfbaked programmer came up with a half century ago fitting the ideal that once were, but that have been inherited by monkeys far more halfbaked then the original programmer that actually had to do these things in assembler or machinelanguage. But one would had think some sort of port of the halfbaked hieroglyphs actually done in C language and reused by some lazy fuck that still think it make sense today.

[toc] | [prev] | [next] | [standalone]


#36696

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-05-31 09:39 +0200
Message-ID<XnsAA60624AE5371eejj99@194.109.6.166>
In reply to#36692
<jonas.thornvall@gmail.com> wrote on 31 May 2019 in comp.lang.javascript: 

> Well i do not fancy decoding "new age hieroglyphs", i prefer some with a
> mystery behind. 

Don't insult others and fail to apologise.

If you post here you should not expect others 
to be interested in what you fullishly fancifully prefer,
you are still the yammering child I mentioned,
not wanting to learn, but just wanting to play outside.



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#36704

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-05-31 04:47 -0700
Message-ID<c606092d-9b3c-4496-a9fd-f3e87ea74560@googlegroups.com>
In reply to#36696
Den fredag 31 maj 2019 kl. 09:39:50 UTC+2 skrev Evertjan.:
> <jonas.thornvall@gmail.com> wrote on 31 May 2019 in comp.lang.javascript: 
> 
> > Well i do not fancy decoding "new age hieroglyphs", i prefer some with a
> > mystery behind. 
> 
> Don't insult others and fail to apologise.
> 
> If you post here you should not expect others 
> to be interested in what you fullishly fancifully prefer,
> you are still the yammering child I mentioned,
> not wanting to learn, but just wanting to play outside.
> 
> 
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

I have not seen any childs building any sequensers or synth editors or synth controllers in javascript yet. But when i am done they probably up to it, because i keep it at a comfortable "basic" level to handle with code that make sense and have a narrow scope inspite of holding global variables. It is short precise and concise what else can a beginner demand of code. And the nice thing is, it is easily improvable since i am not anal enough to care about details.

Sed and regexp possibly have it share of fans but it ain't rocket science, it is a lookup table for the weird commands with origin in the 60's computer era.

I am sure they made sense then but it hardly do now.

If there were a price for programming something complex with least amount of syntactical knowledge, well you know were to send the price.

Just do it!
"Look Ma no hands" 

[toc] | [prev] | [next] | [standalone]


#36705

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-05-31 04:55 -0700
Message-ID<5cf6fc9a-c244-47e4-86ce-d55882a7da9e@googlegroups.com>
In reply to#36696
Den fredag 31 maj 2019 kl. 09:39:50 UTC+2 skrev Evertjan.:
> <jonas.thornvall@gmail.com> wrote on 31 May 2019 in comp.lang.javascript: 
> 
> > Well i do not fancy decoding "new age hieroglyphs", i prefer some with a
> > mystery behind. 
> 
> Don't insult others and fail to apologise.
> 
> If you post here you should not expect others 
> to be interested in what you fullishly fancifully prefer,
> you are still the yammering child I mentioned,
> not wanting to learn, but just wanting to play outside.
> 
> 
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Well i just pointed out that the syntax and semantical meaning of Seds string lookup tables maybe seen it primetime in the 60's. Why would anyone within their sane mind would need to memorise the syntax of Sed strings. We are in a new millenia and you want to kling on to syntax that have its origin in lookup tables.

I am pretty sure you would prefer write your javascripts using emacs and print them out with grep, and replace the string handling with regexp.

Your a dinosaur Evertjan

https://www.youtube.com/watch?v=eySN1u5_FJA

[toc] | [prev] | [next] | [standalone]


#36706

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-05-31 05:01 -0700
Message-ID<26109739-f088-4a18-b066-18771f677e03@googlegroups.com>
In reply to#36705
Den fredag 31 maj 2019 kl. 13:55:14 UTC+2 skrev Jonas Thörnvall:
> Den fredag 31 maj 2019 kl. 09:39:50 UTC+2 skrev Evertjan.:
> > <jonas.thornvall@gmail.com> wrote on 31 May 2019 in comp.lang.javascript: 
> > 
> > > Well i do not fancy decoding "new age hieroglyphs", i prefer some with a
> > > mystery behind. 
> > 
> > Don't insult others and fail to apologise.
> > 
> > If you post here you should not expect others 
> > to be interested in what you fullishly fancifully prefer,
> > you are still the yammering child I mentioned,
> > not wanting to learn, but just wanting to play outside.
> > 
> > 
> > 
> > -- 
> > Evertjan.
> > The Netherlands.
> > (Please change the x'es to dots in my emailaddress)
> 
> Well i just pointed out that the syntax and semantical meaning of Seds string lookup tables maybe seen it primetime in the 60's. Why would anyone within their sane mind would need to memorise the syntax of Sed strings. We are in a new millenia and you want to kling on to syntax that have its origin in lookup tables.
> 
> I am pretty sure you would prefer write your javascripts using emacs and print them out with grep, and replace the string handling with regexp.
> 
> Your a dinosaur Evertjan
> 
> https://www.youtube.com/watch?v=eySN1u5_FJA

https://www.youtube.com/watch?v=OJWJE0x7T4Q

[toc] | [prev] | [next] | [standalone]


#36707

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-05-31 15:43 +0200
Message-ID<XnsAA609FEF9BF19eejj99@194.109.6.166>
In reply to#36705
<jonas.thornvall@gmail.com> wrote on 31 May 2019 in comp.lang.javascript:

> Your a dinosaur Evertjan

Thank you Jonas, for your kind words.

For me, learning is joyfull, 
and infantile copying without understanding is not,
also because it is rather error-prone.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#36708

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-05-31 09:16 -0700
Message-ID<cad5efdd-a5f4-4300-b5a6-6181c7e8de9d@googlegroups.com>
In reply to#36707
Den fredag 31 maj 2019 kl. 15:43:27 UTC+2 skrev Evertjan.:
> <jonas.thornvall@gmail.com> wrote on 31 May 2019 in comp.lang.javascript:
> 
> > Your a dinosaur Evertjan
> 
> Thank you Jonas, for your kind words.
> 
> For me, learning is joyfull, 
> and infantile copying without understanding is not,
> also because it is rather error-prone.
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

Honestly for me it seem like memorise regexp strings is a waste of storage space that i can have better use for. That is why i prefer syntax that has a semantic meaning in english. The semantic of a lookup table is a bit to shorthanded for my taste. But there is probably people who find in joyful to memorise shorthand semantics LoL

[toc] | [prev] | [next] | [standalone]


#36711

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2019-06-01 00:29 +0200
Message-ID<XnsAA614FF8BB7Feejj99@194.109.6.166>
In reply to#36708
=?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 31
May 2019 in comp.lang.javascript: 

> Den fredag 31 maj 2019 kl. 15:43:27 UTC+2 skrev Evertjan.:
>> <jonas.thornvall@gmail.com> wrote on 31 May 2019 in
>> comp.lang.javascript: 
>> 
>> > Your a dinosaur Evertjan
>> 
>> Thank you Jonas, for your kind words.
>> 
>> For me, learning is joyfull, 
>> and infantile copying without understanding is not,
>> also because it is rather error-prone.
> 
> Honestly for me it seem like memorise regexp strings is a waste of
> storage space that i can have better use for.

Which is nonsense, you don't have to learn strings, you learn a compact and 
easy method.

> That is why i prefer
> syntax that has a semantic meaning in english.

So why did you ask?

> The semantic of a lookup
> table is a bit to shorthanded for my taste.

Regex is not a lookup-table.

> But there is probably people
> who find in joyful to memorise shorthand semantics

Wahat is 'shorthand semantics' to you?

> LoL 

I don't find your laziness enjoyable,
remember it was you who askes for help.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#36713

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-06-01 00:07 -0700
Message-ID<37112bde-61cb-45b1-ae6c-fce15ba39506@googlegroups.com>
In reply to#36711
Den lördag 1 juni 2019 kl. 00:29:36 UTC+2 skrev Evertjan.:
> =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 31
> May 2019 in comp.lang.javascript: 
> 
> > Den fredag 31 maj 2019 kl. 15:43:27 UTC+2 skrev Evertjan.:
> >> <jonas.thornvall@gmail.com> wrote on 31 May 2019 in
> >> comp.lang.javascript: 
> >> 
> >> > Your a dinosaur Evertjan
> >> 
> >> Thank you Jonas, for your kind words.
> >> 
> >> For me, learning is joyfull, 
> >> and infantile copying without understanding is not,
> >> also because it is rather error-prone.
> > 
> > Honestly for me it seem like memorise regexp strings is a waste of
> > storage space that i can have better use for.
> 
> Which is nonsense, you don't have to learn strings, you learn a compact and 
> easy method.
> 
> > That is why i prefer
> > syntax that has a semantic meaning in english.
> 
> So why did you ask?
> 
> > The semantic of a lookup
> > table is a bit to shorthanded for my taste.
> 
> Regex is not a lookup-table.

No but regex put meaning into single special characters and at most use two to  represent that functionality. So it is indeed something "that needs to be memorised", and you can't deny it.
 
> > But there is probably people
> > who find in joyful to memorise shorthand semantics
> 
> Wahat is 'shorthand semantics' to you?

What i described above, it is basicly memorisation of hieroglyphs needed to decode. Unfortunately it is an alphabet that i feel the use for is a bit outdated, and i doubt i will put in the effort to learn it.

Actually i am thinking of replacing regex in code with string functions, they make sense and do not need to be commented.


> > LoL 
> 
> I don't find your laziness enjoyable,
> remember it was you who askes for help.
> 
> -- 
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#36714

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-06-01 00:22 -0700
Message-ID<686a9a97-3ef8-4cca-aeda-06c955229915@googlegroups.com>
In reply to#36713
Den lördag 1 juni 2019 kl. 09:07:11 UTC+2 skrev Jonas Thörnvall:
> Den lördag 1 juni 2019 kl. 00:29:36 UTC+2 skrev Evertjan.:
> > =?UTF-8?Q?Jonas_Th=C3=B6rnvall?= <jonas.thornvall@gmail.com> wrote on 31
> > May 2019 in comp.lang.javascript: 
> > 
> > > Den fredag 31 maj 2019 kl. 15:43:27 UTC+2 skrev Evertjan.:
> > >> <jonas.thornvall@gmail.com> wrote on 31 May 2019 in
> > >> comp.lang.javascript: 
> > >> 
> > >> > Your a dinosaur Evertjan
> > >> 
> > >> Thank you Jonas, for your kind words.
> > >> 
> > >> For me, learning is joyfull, 
> > >> and infantile copying without understanding is not,
> > >> also because it is rather error-prone.
> > > 
> > > Honestly for me it seem like memorise regexp strings is a waste of
> > > storage space that i can have better use for.
> > 
> > Which is nonsense, you don't have to learn strings, you learn a compact and 
> > easy method.
> > 
> > > That is why i prefer
> > > syntax that has a semantic meaning in english.
> > 
> > So why did you ask?
> > 
> > > The semantic of a lookup
> > > table is a bit to shorthanded for my taste.
> > 
> > Regex is not a lookup-table.
> 
> No but regex put meaning into single special characters and at most use two to  represent that functionality. So it is indeed something "that needs to be memorised", and you can't deny it.
>  
> > > But there is probably people
> > > who find in joyful to memorise shorthand semantics
> > 
> > Wahat is 'shorthand semantics' to you?
> 
> What i described above, it is basicly memorisation of hieroglyphs needed to decode. Unfortunately it is an alphabet that i feel the use for is a bit outdated, and i doubt i will put in the effort to learn it.
> 
> Actually i am thinking of replacing regex in code with string functions, they make sense and do not need to be commented.
> 
> 
> > > LoL 
> > 
> > I don't find your laziness enjoyable,
> > remember it was you who askes for help.
> > 
> > -- 
> > Evertjan.
> > The Netherlands.
> > (Please change the x'es to dots in my emailaddress)
From Wiki
Shorthand is an abbreviated symbolic writing method that increases speed and brevity of writing as compared to longhand, a more common method of writing a language.

From me
Symbolic writing do not need to have connotation to the semantic of speaking and reading language, that means you basicly have to memorise and lookup its meaning   in a list or lookup table.

That is why i think functions should be named using english semantic and use name that state their purpose.

[toc] | [prev] | [next] | [standalone]


#36716

FromLuuk <luuk@invalid.lan>
Date2019-06-01 09:45 +0200
Message-ID<5cf22d0b$0$22343$e4fe514c@news.xs4all.nl>
In reply to#36713
On 1-6-2019 09:07, Jonas Thörnvall wrote:

> 
> Actually i am thinking of replacing regex in code with string functions, they make sense and do not need to be commented.
> 
> 

Good luck with doing that, and i would like to see the results of this 
piece if javascript in code with string functions. (Just for learning 
puposes, of 'how-to-do-it-the-other-way')

let source = "1 qwerty\n2 asdfg\nqweeee\n4 z"
let result = source.replace(/^[^0-9].*\n/gm, '');



-- 
Luuk

[toc] | [prev] | [next] | [standalone]


#36717

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-06-01 00:53 -0700
Message-ID<21f97566-8158-4696-b830-488c5e4087ed@googlegroups.com>
In reply to#36716
Den lördag 1 juni 2019 kl. 09:45:21 UTC+2 skrev Luuk:
> On 1-6-2019 09:07, Jonas Thörnvall wrote:
> 
> > 
> > Actually i am thinking of replacing regex in code with string functions, they make sense and do not need to be commented.
> > 
> > 
> 
> Good luck with doing that, and i would like to see the results of this 
> piece if javascript in code with string functions. (Just for learning 
> puposes, of 'how-to-do-it-the-other-way')
> 
> let source = "1 qwerty\n2 asdfg\nqweeee\n4 z"
> let result = source.replace(/^[^0-9].*\n/gm, '');
> 
> 
> 
> -- 
> Luuk

Well maybe i was not clear this "could hardly" be done on the full textblock. But after split there is no problem. You have to loop thru the array elements "lines".

I hope you see that.

[toc] | [prev] | [next] | [standalone]


#36718

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-06-01 01:01 -0700
Message-ID<550e13cd-8e6c-4d46-a8dc-47e95242174a@googlegroups.com>
In reply to#36717
Den lördag 1 juni 2019 kl. 09:53:41 UTC+2 skrev Jonas Thörnvall:
> Den lördag 1 juni 2019 kl. 09:45:21 UTC+2 skrev Luuk:
> > On 1-6-2019 09:07, Jonas Thörnvall wrote:
> > 
> > > 
> > > Actually i am thinking of replacing regex in code with string functions, they make sense and do not need to be commented.
> > > 
> > > 
> > 
> > Good luck with doing that, and i would like to see the results of this 
> > piece if javascript in code with string functions. (Just for learning 
> > puposes, of 'how-to-do-it-the-other-way')
> > 
> > let source = "1 qwerty\n2 asdfg\nqweeee\n4 z"
> > let result = source.replace(/^[^0-9].*\n/gm, '');
> > 
> > 
> > 
> > -- 
> > Luuk
> 
> Well maybe i was not clear this "could hardly" be done on the full textblock. But after split there is no problem. You have to loop thru the array elements "lines".
> 
> I hope you see that.

Stringhandling is about break down problems into smaller and easier ones.

[toc] | [prev] | [next] | [standalone]


#36721

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2019-06-01 01:55 -0700
Message-ID<90547d23-998c-4e62-a09a-5d0e6879e02a@googlegroups.com>
In reply to#36716
Den lördag 1 juni 2019 kl. 09:45:21 UTC+2 skrev Luuk:
> On 1-6-2019 09:07, Jonas Thörnvall wrote:
> 
> > 
> > Actually i am thinking of replacing regex in code with string functions, they make sense and do not need to be commented.
> > 
> > 
> 
> Good luck with doing that, and i would like to see the results of this 
> piece if javascript in code with string functions. (Just for learning 
> puposes, of 'how-to-do-it-the-other-way')
> 
> let source = "1 qwerty\n2 asdfg\nqweeee\n4 z"
> let result = source.replace(/^[^0-9].*\n/gm, '');
> 
> 
> 
> -- 
> Luuk

In principle this should work but i am terrible with the syntax so... It doesn't now i showed "the other way", can you show med where it go wrong becaues apparently my splice do not remove the lines.

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.javascript


csiph-web