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


Groups > comp.lang.javascript > #36684

Re: Remove all lines where first character is not a digit.

Newsgroups comp.lang.javascript
Subject Re: Remove all lines where first character is not a digit.
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <9ff34af1-9e27-4f78-b686-990dcea4371d@googlegroups.com>
Date 2019-05-31 00:05 +0200
Message-ID <XnsAA60EA3F293eejj99@194.109.6.166> (permalink)

Show all headers | View raw


<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)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web