tags:

views:

65

answers:

2

If i want to change the below

Hello

To:

HELLO

Its fine when i do \(Hello)\

But it dosent work for words such as:

HeLLo hello HellO

Is there any way i can get regex to pick all hello characters?

+3  A: 

use incasesensitive modifier of your library for instance

/hello/i

Also it would be wise to add \b, word delimiter so you do not select "ahello".

/\bhello\b/i
M. Utku ALTINKAYA
+5  A: 

Depending on your regular expression engine, there should be a way to indicate a case insensitive match.

For example, in Perl:

/Hello/i

or Python:

re.compile(r"hello", re.IGNORECASE)

Alternatively, you can do it manually for each character:

[Hh][Ee][Ll][Ll][Oo]
Greg Hewgill