Groovy =~ operator case insensitive?

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc
Post Reply
Posts: 34
Joined: 14 Jul 2018, 17:22

Groovy =~ operator case insensitive?

Post by howdymilsap »

I am working to reorganize a bunch of data and am running into some issue with case-sensitive naming.

I am trying to use the groovy find operator like this:

Code: Select all

 f =~ /DVDR|DVD5|DVD 5|DVD9|DVD 9/ ? 'DVD/movies' 
But I am finding that this does a case-sensitive search. Is there a way to make this case-insensitive?
User avatar
The Source
Posts: 19015
Joined: 16 Nov 2011, 08:59
Location: Taipei

Re: Groovy =~ operator case insensitive?

Post by rednoah »

You can add (?i) at the beginning of your regex to turn on the case-insensitive flag:


Code: Select all

/(?i)DVD[ _.]?[R59]/
:idea: Please read the FAQ and How to Request Help.
Post Reply