# Using Case
(?-i:WTF)\? # matches "WTF?" not "wtf?"
(?-i:T)om # match "Tom" or "TOM"
(?-i)T(?i)om # same thing (disable case after "T")
(?-i:TOM) # match "TOM" but not "Tom" or "tom"
(?-i)TOM(?i) # same thing
\b(?-i:TOM) # better to use word boundary '\b'
# to not match words like "CUSTOMIZE"
# Using (?-i) at the start of the PCRE
# applies to the entire string
(?-i)\bWTF\? # matches "WTF?" not "wtf?"
^(?-i)[A-Z ]+$ # match subject with only uppercase
# letters or spaces
^(?-i)[^a-z]+$ # match subject with only upper case
# letters, spaces, numbers, or punctuation
# (no lower case letters)
# Using (?-i) inside the expressions applies from
# that point foreward unless disabled with (?i).
# The following PCRE:
Four Score and Seven (?-i)Years Ago
# matches either of these
"Four Score and Seven Years Ago"
"Four score and seven Years Ago"
# does not match these
"Four score and seven Years ago"
"FOUR SCORE AND SEVEN YEARS AGO"