-1

I am trying to find a solution for a regex pattern, that is needed to determine if a word is matching the pattern, but for any variation of it.

For example: The pattern needs to match: "phone", but it also needs to match: "Phone", "PHONE", "pHone", "phOne", etc. So it shouldn't matter the type of case for any position in that string.

Is that possible in regex? Thanks for your time!

nw5280
  • 137
  • 1
  • 2
  • 9

1 Answers1

2

In plain regex, you can do:

[Pp][Hh][Oo][Nn][Ee]

If you are using a programming language, it might be simpler to test if string.lower() == "phone".

Irfan434
  • 1,463
  • 14
  • 19