You can also do a clipping mask to get the same effect. Just put the pattern below the shape or "mask" then go to object - clipping mask - make.