In python the regexes allow you to call a function instead of just 
substitute the values (see <http://docs.python.org/lib/node111.html> for 
more details). That seems quite useful, is there something similar in ruby?

Also, let's say I want match anything between "a" and "b" unless it 
contains the word "foo". I could write two regexes like so:

if str =~ /a(.*)b/ and str !~ /a(.*foo.*)b/

Is there a good way to make that kind of logic into one regex? Is there 
some kind of "intersect" operator or a "not" operator?

Regards,
    Jeff Davis