[OS X TeX] regular expression matching in TeXShop

Charilaos Skiadas skiadas at hanover.edu
Fri Dec 22 00:26:08 CET 2006


On Dec 21, 2006, at 9:34 PM, Alan Munn wrote:

> Suppose I have the following table:
>
> \begin{tabular}{lllllllll}
> A & B & C & D & E & F & G & H & I & J\\
> A & B & C & D & E & F & G & H & I & J\\
> A & B & C & D & E & F & G & H & I & J\\
> A & B & C & D & E & F & G & H & I & J\\
> A & B & C & D & E & F & G & H & I & J\\
> A & B & C & D & E & F & G & H & I & J\\
> A & B & C & D & E & F & G & H & I & J\\
> \end{tabular}
>
>
> So the regular expression
>
> ^(([^\&]*\&){1,3})
>
> Should match the first 3 columns of the table (assuming I position  
> the cursor before the first character of the first row.)
>
> This would allow an easy way to insert a column after e.g. the  
> third row, by making the replace field "\1  & "
>
> But for some reason, the expression doesn't seem to pay attention  
> to the beginning of the line, so if you search at the beginning of  
> the first line of the table, and it correctly selects the first  
> three columns, but when you click 'Next' you get the next three  
> columns rather than the first three of the rest of the line.

Your regexp works as desired in TextMate, I don't think it should be  
any different in other editors either.

Haris



------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the macostex-archives mailing list