<< Previous page                  Page 4 of 10               Next Page >>


L A P I S

More Constraints

 

Just before and just after are another useful pair of constraints. Just before selects a region matching the first pattern only if it appears immediately before a region matching the second pattern. The regions can be separated by spaces and linebreaks, but not by letters or punctuation. For example:
State just before ZipCode
Try this pattern now. You should see it select "PA" and "MA", but not "Massachusetts" because it doesn't appear immediately before a region matching ZipCode.
Jared L. Cohon
Carnegie Mellon University
5000 Forbes Ave
Pittsburgh PA 15213

Charles M. Vest
Massachusetts Institute of Technology
77 Massachusetts Ave
Cambridge MA 02139
Just after is opposite in sense to just before, so ZipCode just after State would select the ZIP codes instead.

Starting and ending are also useful constraints. Starting selects a region only if it starts at the same place as a region matching the second pattern. For ending, the regions must end at the same place. For example:
Word starting "c"
Try this pattern now. You should see it select every word in the page that starts with the letter c.

Other constraints are also available, including anywhere before,anywhere after, and equal to. You'll find a complete list of constraints in the pattern language reference at the end of this tutorial.

<< Previous page                  Page 4 of 10               Next Page >>

Go to the LAPIS home page.
Send comments or questions to Rob Miller, (rcm@lcs.mit.edu)
Copyright © 2003 - Massachusetts Institute of Technology. All Rights Reserved.