On Feb 22, 2006, at 2:08 AM, Oliver Taylor wrote:
So, to restate my question in a more clear way... (thanks for your patience Haris) I know nothing about programming...
You've done amazingly well with the bundle so far. I'm very impressed.
I'm trying to run a perl search/replace command via a 'bundle command'. I've
First of all, why don't you use the find&replace feature of TextMate? Then you could record the whole thing as a macro.
entered the following into the 'Edit Command' box:
perl -pe ' s/^([A-Z]+.*[A-Z]*\s*)\n((.+))\n(.+)$/\n\n\t\t\t\t$1\n\t\t\t$2\n \n$3/g; ' I've set the input to 'Entire Document' and the output to 'Create New Document'.
Create New Document? So, you don't want it to replace the text in the current document?
But when I run the command none of the tabs or newlines I've specified in the replace section of the command are applied to the text in question. I've also tried the command with the 'e' option at the end which, as far as I can tell, is supposed to evaluate the right side of the search/replace command as regex... but it's not working.
I don't know much about the perl regexp stuff, but if you are seeing neither tabs nor \t's in the resulting document, that can only mean that the regexp is not matching. The reason I think is the following: Not knowing how the perl engine works, there are two possibilities: 1) It searches each line separately, in which case it won't match the multiline search you are performing 2) (more likely) it does a search over the whole thing, in which case I think that ^ and $ might actually stand for the beginning and end of the input, instead of ends of lines. So maybe a search without ^ and with ([^\n]+) instead of (.+)$ might do the trick.
Or maybe I've gotten the whole thing wrong.
Haris