13

If I am matching a word in a regex 'Strict-Transport' how can I make it case insensitive? Is there any way other than putting the two character cases [Ss] for each character because it is not about the initials, but all the characters can come in any case?

I looked at previous posts but there are not like my case. This post for example shows how to make regex case insensitive when using list of characters []. But my case is a word in regex.

user9371654
  • 1,868
  • 12
  • 37
  • 65

1 Answers1

24

You can use i modifier to make regex case-insensitive, e.g.:

(?i)ab

will match ab, Ab, aB and AB

Kirill Polishchuk
  • 52,773
  • 10
  • 120
  • 121