Page 1 of 1

Groovy =~ operator case insensitive?

Posted: 05 Oct 2018, 00:54
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?

Re: Groovy =~ operator case insensitive?

Posted: 05 Oct 2018, 07:53
by rednoah
You can add (?i) at the beginning of your regex to turn on the case-insensitive flag:
https://www.regular-expressions.info/modifiers.html

e.g.

Code: Select all

/(?i)DVD[ _.]?[R59]/