AMAN KUMAR
AMAN KUMAR

Reputation: 277

Regex pattern for filename in groovy

I have groovy script which list filenames based on argument passed. And I want to list filename containing b so, I'm providing filename in regex pattern as argument like: (*.)b(*.).*

But while running the command I'm getting: -bash: syntax error near unexpected token `('

Upvotes: 0

Views: 2529

Answers (1)

daggett
daggett

Reputation: 28564

new File("./folder/to/scan").eachFileMatch( ~/.*b.*/ ){file->
    println file
}

Upvotes: 1

Related Questions