[TxMt] regex question

Oliver Taylor oliver at ollieman.net
Tue Feb 21 23:23:12 UTC 2006


On Feb 21, 2006, at 2:58 PM, Haris wrote:

> Oliver: One thing you could try, if these things are hierarchical,  
> is to have a begin pattern for the first line, and ending in  
> something hopefully meaningful.

Here's what i managed to come up with:

begin = '^[A-Z]{2,10}.*[A-Z]*(\s*|\()$';
end = '\.$|\?$|\!$|--$|-$';

...which suits my needs *okay* but not perfectly.
----------
I'm using the following (adapted from Dr. Drang's suggestion):

^([A-Z]+.*[A-Z]*\s*)\n(\(.+\))\n(.+)$

for a search and replace string like this one:

s/^([A-Z]+.*[A-Z]*\s*)\n(\(.+\))\n(.+)$/\n\n\t{4}$1\n\t{3}$2\n\{2}$3/;

...which makes sense to me, but it doesn't insert those tabs or  
newlines when piped thru a command. Clearly I'm missing something  
here. As you can no-doubt tell, I'm a complete noob when it comes to  
all this programing.

As an example, this:
-----------------
OLIVER
(I want to tell you)
I've got things to say.
Dr. Robert
-----------------
should look like this:
---------------------------

				OLIVER
			(I want to tell you)
		I've got things to say.

Dr. Robert
---------------------------

> If I may suggest, it would be helpful if you add a test screenplay  
> in the bundle, so that anyone in the future working on it knows how  
> it looks like and what not to break. Like the test.tex we have in  
> the LaTeX bundle.

I'll do that.



More information about the textmate mailing list