On Tue, 1 Mar 2005 12:55:16 -0700, Jacob Fugal <[EMAIL PROTECTED]> wrote:
> |
> 
> /foo|bar/ matches "foofighter" and "barbecue"

I also meant to include this, but spaced it before hitting send.

If you want to multiple character switch, but not a complete
either-or, group with parentheses:

/cor(ian|ri)dor/ matches either 'coriandor' or 'corridor'

If you are using () to catch parts of the match and export to $1, $2,
etc., and you don't want the grouping for the | to throw off the count
(or if you're concerned about speed/memory limitations of the capture)
you can exempt the parens from doing a capture using ?:, eg.

/cor(?:ian|ri)dor/

Jacob Fugal

--------------------
BYU Unix Users Group 
http://uug.byu.edu/ 

The opinions expressed in this message are the responsibility of their
author.  They are not endorsed by BYU, the BYU CS Department or BYU-UUG. 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to