Here to the paragraph search data, size if you want to touch thoroughly or write a few pieces of code yourself try It
The corresponding inline flag expression is (? i), which has four different forms:
1, (? i)
2, (?-I.)
3, (? i:x)
4, (?-i:x)
Not with-is the opening sign, with-is off the mark.
public class Test {
public static void Main (string[] args) {
String str = "book";
System.out.println (Str.matches (regex));
}
We have achieved the same effect, of course it is not the best, because only B in the string is uppercase,
We do not need to match all the characters in a case-insensitive case, we can open the logo with the
The second form immediately shuts it down:
String regex = "(? i) b (? i) ook";
In this case, only B is case-sensitive, and the following (?-i) still have to be case-sensitive. Write like this
May seem very uncomfortable, we can also use the 3rd form to directly specify that some characters are case-insensitive.
String regex = "(? i:b) Ook";
Such an expression is semantically the same as the one above. On the efficiency is definitely better than suddenly open, suddenly shut.
Visible inline flag Expressions are much more powerful than specifying compilation parameters.
Use recommendations: If you can determine the case of certain characters, try to use the identified characters, for the indeterminate can be used
(? i:x) in the manner specified. So when you open a case-insensitive switch, there is a certain effect on the performance of the match.
Think about it: String regex = "(? i) b (?-i:oo) k"; The meaning of this expression.
(? i) indicates that the expression on the right side of the location opens ignoring the case mode (? i) to the right of the expression close ignores case mode