How to clip a mesh from another (runtime)?

For example, a character has a hair mesh attached to his head, now we also need to add a helmet to his head.

If the helmet is directly attached to his head, it will look strange as if the hair had gone through the helmet. But if we hide the hair mesh, it will be too evident.

So what we need to do is to try to reserve the part of the hair that is inside the helmet, and clip the rest. How can we implement this?

P.S. both of the helmet mesh and the hair mesh are skeletal meshes.

Thanks a lot.