Filter shadowJar content using regex

I need to include projects into shadowJar according to regex pattern. I thought it would be something like this, but it’s not worked:

shadowJar {
    dependencies {

I’m not familiar enough with gradle so an answer is probably pretty obvious, but I haven’t found it anywhere, so is it possible to do somehow?