home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news!netlabs!lwall
- From: lwall@netlabs.com (Larry Wall)
- Newsgroups: comp.lang.perl
- Subject: Re: String matching with matching delimiters
- Message-ID: <1992Sep1.212635.26399@netlabs.com>
- Date: 1 Sep 92 21:26:35 GMT
- References: <59999@mimsy.umd.edu>
- Sender: news@netlabs.com
- Distribution: usa
- Organization: NetLabs, Inc.
- Lines: 21
- Nntp-Posting-Host: scalpel.netlabs.com
-
- In article <59999@mimsy.umd.edu> folta@cs.umd.edu (Wayne Folta) writes:
- : I have been doing a lot of work lately manipulating TeX files with perl. Is
- : there an easy way to give a pattern like:
- :
- : /\\hbox{ ... }/
- :
- : Where the "..." includes everything up to the *matching* brace. This may
- : include closing braces, so "{[^}]+}" does not work. Presently, I loop through
- : the string counting opens and closes by hand... I don't think rexegp's are
- : powerful enough to do it alone, but in perl...
-
- I've considered adding some kind of automatic tokenizing, but for now
- you just have to s/// the front off the string and count brackets. This
- is really way beyond the capabilities of regular expressions.
-
- : (Also, could rindex be enhanced to be able to match the right-most ocurrence
- : *before* a certain point? I.e. to be symmetrical with index.)
-
- Already does. Try supplying a third argument.
-
- Larry
-