[OS X TeX] TeXShop regex: matching braces, fancy patterns

Maarten Sneep maarten.sneep at xs4all.nl
Sat Apr 9 22:20:50 CEST 2005


On 9 apr 2005, at 21:15, Roger Hart wrote:

> I have a couple questions about regular expressions in TeXShop:

As far as I know, TeXShop uses OgreKit, which offers many variants of 
regular expressions. The site is completely in Japanese, so I do 
require some help to read the documentation there. It is not the PCRE 
library used in many other applications, I can't check the site for 
kown incompatibilities.

> Is there any way to find matching braces, that is, given that more 
> matching braces might possibly be nested? _Programming Perl_, p. 214, 
> offers one method, but it requires a matching regex from embedded Perl 
> code,
>
> (??{ $np })
>
> which I can't seem to get to work. This then is my second question: I 
> can't seem to get some of the "fancy patterns" in "Programming Perl" 
> to work from TeXShop's Find panel. Most do work, for example the 
> look-ahead and look-behind, modifying case-sensitivity with (?i: ). 
> But some do not, for example, conditionals, and executing perl code, 
> such as,

Not surprising, as you're not working in Perl, so a large part of the 
engine required to get that to work is missing. I guess you could 
create a unix filter in Perl that does what you want.

> Is this a limitation of the implementation in TeXShop, or have I 
> installed something incorrectly, or is there  something that needs 
> updating?

not so much updating as writing from scratch, I think. TextWrangler 
uses a syntax that is much closer to Perl, and balance braces and 
highlighting, so a completely different editor may be a work around.

> Again, I should note that TeXShop is a wonderful program, and having 
> (at least most of) perl regex capabilities is fantastic. I can find 
> some other way to solve this, I suppose, but if possible I'd prefer to 
> be able to do it in TeXShop, where I do all of my editing.

As an integrated tool, TeXShop is very nice, but there are other 
applications out there that do a better job of the editor part: AlphaX, 
CE emacs, TextWrangler, BBEdit, ... are all very powerful editors that 
focus more on the editor bit. There is a reason that you can use an 
external editor with TeXShop.

Maarten

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list