[TxMt] TM freezes completely on search&replace in 6K-lines XML-File!
Paul McCann
paul.mccann at adelaide.edu.au
Tue Jan 17 00:10:34 UTC 2006
Tom Lazar wrote:
> I work with it all the time and never experienced any problems.
> except for right now, when i did a search and replace with regular
> expressions, just simply remoing all line-breaks, ie. replacing
> '\n' with nothing.
Confirmed (on a circa 1500 line xml file: spinning ball for about 30
seconds for a regex replace of "\n" with ''). Seems to be somehow
tied in with the fact that we're searching for "\n", as any other
search, even with regex turned on, seems to be at least an order of
magnitude quicker. For instance, I searched for "a" and replaced it
with "<??>" (ie something unlikely to occur in the file) with regex
turned on, and the query has four times as many matches and returns
in a couple of seconds.
> can anybody shed any light on this or give some advice, what other
> product to use for the 'heavy lifting stuff'?
Would you believe "TextMate"?
Text => Filter through command... => (Input: Document, Output:
Replace Selection)
perl -pe 's/\n//g'
Pretty much instant. Undo is also virtually instant, should you not
like what it's done to your document! While the "g" isn't strictly
necessary in this instance it is in general if you're wanting to
replace all occurrences.
For more generic regex substitutions just throw your "Find" and
"Replace" regexes between the leaning matchsticks. For case
insensitive matching you can use
perl -pe 's/\n//gi'
instead. Not ideal, but infinitely faster than the builtin (for now).
Cheers,
Paul
More information about the textmate
mailing list