octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51589] crash on regexp


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #51589] crash on regexp
Date: Fri, 28 Jul 2017 00:57:21 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #9, bug #51589 (project octave):

The method that Rik suggests is often how I do processing on a formatted file
of the sort you have.

However, one should still be able to make use of regexp() by thinking more in
terms of parring down starting with bigger hunks.  I think the issue is that
the regexp construct you've used gets way too many hits and therefore the
recursion is too high that stack overflow occurs.  It looks like you are
searching for everything that matches exponential notation numbers.  Instead,
try thinking of ways to reduce the number of "hits".

For example, this regexp() will first produce the blocks:


octave:31> fid=fopen("oc.txt",'r');
octave:32> text = char (fread (fid, "uchar")');
octave:33> fclose(fid);
octave:34> [S, E, TE, M, T, NM, SP] = regexp (text, '(Step)'); %break into
blocks


The SP should contain all the text between the "Step" in the file.  Loop
through the SP and then use regexp() again to find maybe all individual lines.
 Then toss out the line that doesn't have the exponential floating point
numbers.  Then pick the first and last exp-floating point lines.

There are probably a half dozen uses of expressions keeping and/or discarding
content, etc. that should get what you want.  Experiment a bit I guess.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51589>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]