Simon Glover: # Right: the real cause of the second bug is similar to what I # thought it # was - when it sees a float, the regex engine first checks to # see if it # is an integer by trying the substitution: # # s/^(-?\d+)(?!\.)// # # The problem is that when, say, 10000.0 gets fed to this, and fails # to match, the regex engine starts to back up, until it sucessfully # matches (and erases) 1000, leaving 0.0 to be parsed on the next # iteration of the loop, and hence producing incorrect output. # # The best way that I've been able to think of to fix this is to swap # the order of the integer and float comparisons, so that any floats # get matched before we get to the above; if anyone else can think of a # better way, or some reason why this won't work, I'd be glad # to hear it.
If the problem is backtracking, can't you just use the (?>) no-backtracking syntax? --Brent Dax [EMAIL PROTECTED] Parrot Configure pumpking and regex hacker <obra> mmmm. hawt sysadmin chx0rs <lathos> This is sad. I know of *a* hawt sysamin chx0r. <obra> I know more than a few. <lathos> obra: There are two? Are you sure it's not the same one?