At 09:56 -0500 12/8/11, Ronald J Kimball wrote:
>On Thu, Dec 08, 2011 at 06:39:37AM -0800, David wrote, and I snipped
>> 
>> Is this a BBEdit problem, or a problem with the regex search?
>
>Probably a combination of both.  There may be an entry in your text file
>that almost matches, but not quite, and the regex engine does so much
>backtracking to try to match it that the stack blows up and BBEdit gets
>hung.
>
>Please send me your file.  I can take a look at it tonight and try to
>improve the regex to avoid all the unnecessary backtracking.

That regex is truly a work of art !

Two things though are not clear to me:

The [ \t]*  (space and tab)  sequences seem to be too much and too often.  As I 
see the data there are no tabs in it though that might be an email thing.  Just 
using ' *' (\ *),  (escaped space star) might be a significant reduction in the 
work required by the regex software.

Those asterisks in the detailed trip lines don't seem to be specifically 
allowed for. The * character has a special meaning in the regex and somehow the 
*'s in the text file must be allowed for in  one of the .*\r (anything repeated 
until a return) expressions. Do they need to be tagged as not greedy when the 
regex is dealing with line ends internally?

The  lines to be counted begin with three spaces and end with two spaces and a 
digit.  That looks pretty easy to count in a line by line reader.  Counting the 
asterisks globally might  also be a quick route to the desired result.

I firmly believe that all regex schemes are a work of trial and error. By all 
means send the file to Ron. I'd like to see the final result.

If you give up because BBedit is overflowing its stack I can help with a perl 
script but I would read the file line by line and collect data in variables 
devoted to the task at hand. Perhaps a preprocessor that creates an output file 
that is easier to work with in BBEdit or a spreadsheet.
-- 

-->  Halloween  == Oct 31 == Dec 25 == Christmas  <--

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to