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


Groups > comp.lang.javascript > #37832

Re: Parse out after newline and paragraph?

Newsgroups comp.lang.javascript
Date 2019-11-22 03:58 -0800
References <d088ea44-e208-40fd-9a85-f2178820eb01@googlegroups.com> <1kby42xl1ihl.1e9zoms9j2hcv$.dlg@40tude.net>
Message-ID <92ee491e-e27f-4d55-a363-cea94b811f76@googlegroups.com> (permalink)
Subject Re: Parse out after newline and paragraph?
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den fredag 22 november 2019 kl. 12:36:38 UTC+1 skrev JJ:
> On Fri, 22 Nov 2019 02:10:12 -0800 (PST), Jonas Thörnvall wrote:
> > ": [
> >         {
> >           "duration": 0.0881409374999933,
> >           "durationTicks": 22,
> >           "midi": 72,
> >           "name": "C5",
> >           "ticks": 13056,
> >           "time": 52.30764,
> >           "velocity": 0.952755905511811
> > 
> > I try to parseout the time from string above, but i do not manage get rid
> > of the comma after time event.
> > 
> > It is probably because i do not know how to adjust relative the paragraph?
> > 
> > impTimeStart=impNote[IN].indexOf('"time": ');
> > impTimeEnd=impNote[IN].indexOf(',\n"velocity":');
> > impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
> > 
> > I do not do much parsing so a full example, would be nice. Maybe i just do
> > it a silly way to start with.
> > 
> > Jonas T
> 
> It's more simpler to just use regular regex. e.g.
> 
>   impTime = impNote[IN].match(/"time": (\d+(?:\.\d+))/)[1];

Yeah i see it works JJ, but i kind of promised myself to never use none selfexplanationary code. To decode that you must learn regexp, by heart.

I think i stick with replace to remove it.

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


Thread

Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 02:10 -0800
  Re: Parse out after newline and paragraph? JJ <jj4public@vfemail.net> - 2019-11-22 18:36 +0700
    Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 03:58 -0800
      Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 04:09 -0800
        Re: Parse out after newline and paragraph? JJ <jj4public@vfemail.net> - 2019-11-23 08:38 +0700
          Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 23:31 -0800
  Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-22 18:25 +0000
    Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 11:09 -0800
      Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-23 10:51 +0000
        Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-23 05:04 -0800
          Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-23 18:37 +0000
            Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-24 09:58 -0800
              Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-24 18:51 +0000
            Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-24 10:01 -0800
              Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-24 19:28 +0000
                Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-25 01:19 -0800
                Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-25 18:28 +0000
                Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-26 04:24 -0800
                Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-27 05:41 -0800
                Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-30 08:47 -0800
                Re: Parse out after newline and paragraph? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-11-30 10:38 -0800
                Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-30 11:21 -0800
  Re: Parse out after newline and paragraph? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-11-22 10:43 -0800
    Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 11:11 -0800
      Re: Parse out after newline and paragraph? luserdroog <luser.droog@gmail.com> - 2019-11-23 12:09 -0800
        Re: Parse out after newline and paragraph? Julio Di Egidio <julio@diegidio.name> - 2019-11-23 18:21 -0800
          Re: Parse out after newline and paragraph? Julio Di Egidio <julio@diegidio.name> - 2019-11-23 19:08 -0800
            Re: Parse out after newline and paragraph? luserdroog <luser.droog@gmail.com> - 2019-11-23 19:52 -0800
              Re: Parse out after newline and paragraph? Julio Di Egidio <julio@diegidio.name> - 2019-11-23 21:54 -0800
          Re: Parse out after newline and paragraph? luserdroog <luser.droog@gmail.com> - 2019-11-23 18:56 -0800

csiph-web