I want to set a cursor in javascript so when I use regex, it recognizes what data it has already parsed, and continues from that point. Below is a snippet of code that shows what the file is like.
# vtk DataFile Version 4.0
-3659.0757 3746.6780 3628.1143
-3659.6714 3746.2517 3627.9539
-3660.1450 3745.8142 3627.9270
-3660.4631 3745.3735 3628.0605
-3660.6931 3745.0708 3628.1416
LINES 207 31529
581 0 1 2 3 4 ... 579 580
Currently I pick up the float float float pattern correctly, and I want my code to continue to LINES 207 31529 and then 581. This code picks up LINES, but instead of going to the 581 it goes back to the top of the file and takes 4 for numLines.
var LINES = /(LINES)[ ]+[\d]+[ ]+[\d]+[\n]/;
var recogLines = /[\d]+/;
var numLines = parseInt(recogLines.exec(data));
I saw something online about \G, but I don't think javascript recognizes that (or I'm just not using it correctly). How do I keep a cursor so the same data isn't iterated over and over again? Thanks!