Lines 69-81
Link Here
|
69 |
/** |
69 |
/** |
70 |
* Match the pattern literally. |
70 |
* Match the pattern literally. |
71 |
*/ |
71 |
*/ |
72 |
LITERAL(Bundle.LBL_MatchType_Literal(), 'r'), |
72 |
LITERAL(Bundle.LBL_MatchType_Literal(), 'L'), |
73 |
/** |
73 |
/** |
74 |
* The pattern can contain basic wildcards, star (*) for any string and |
74 |
* The pattern can contain basic wildcards, star (*) for any string and |
75 |
* questionaire (?) for any character. The escape character for these |
75 |
* questionaire (?) for any character. The escape character for these |
76 |
* wildcards is backslash (\). |
76 |
* wildcards is backslash (\). |
77 |
*/ |
77 |
*/ |
78 |
BASIC(Bundle.LBL_MatchType_Basic_Wildcards(), 'B'), |
78 |
BASIC(Bundle.LBL_MatchType_Basic_Wildcards(), 'r'), |
79 |
/** |
79 |
/** |
80 |
* The pattern follows java.util.regex.Pattern syntax. |
80 |
* The pattern follows java.util.regex.Pattern syntax. |
81 |
*/ |
81 |
*/ |
Lines 102-114
Link Here
|
102 |
case 'R': |
102 |
case 'R': |
103 |
return REGEXP; |
103 |
return REGEXP; |
104 |
case 'r': |
104 |
case 'r': |
|
|
105 |
return BASIC; |
106 |
case 'L': |
105 |
return LITERAL; |
107 |
return LITERAL; |
106 |
case 'B': |
108 |
default: |
107 |
return BASIC; |
109 |
return BASIC; |
108 |
default: |
|
|
109 |
return LITERAL; |
110 |
} |
110 |
} |
111 |
} |
111 |
} |
|
|
112 |
|
113 |
private static boolean isCanonicalPatternFlag(char ch) { |
114 |
for (MatchType mt : MatchType.values()) { |
115 |
if (mt.getCanonicalPatternFlag() == ch) { |
116 |
return true; |
117 |
} |
118 |
} |
119 |
return false; |
120 |
} |
112 |
} |
121 |
} |
113 |
|
122 |
|
114 |
/** |
123 |
/** |
Lines 150-162
Link Here
|
150 |
* @param searchExpression non-null String of a searched text |
159 |
* @param searchExpression non-null String of a searched text |
151 |
* @param wholeWords if true, only whole words were searched |
160 |
* @param wholeWords if true, only whole words were searched |
152 |
* @param matchCase if true, case sensitive search was preformed |
161 |
* @param matchCase if true, case sensitive search was preformed |
153 |
* @param regExp if true, regular expression search was performed |
162 |
* @param regExp if true, regular expression search was performed; if false, |
|
|
163 |
* search with basic wildcards was performed |
154 |
* @return a new SearchPattern in accordance with given parameters |
164 |
* @return a new SearchPattern in accordance with given parameters |
155 |
*/ |
165 |
*/ |
156 |
public static SearchPattern create(String searchExpression, boolean wholeWords, |
166 |
public static SearchPattern create(String searchExpression, boolean wholeWords, |
157 |
boolean matchCase, boolean regExp) { |
167 |
boolean matchCase, boolean regExp) { |
158 |
return new SearchPattern(searchExpression, wholeWords, matchCase, |
168 |
return new SearchPattern(searchExpression, wholeWords, matchCase, |
159 |
regExp ? MatchType.REGEXP : MatchType.LITERAL); |
169 |
regExp ? MatchType.REGEXP : MatchType.BASIC); |
160 |
} |
170 |
} |
161 |
|
171 |
|
162 |
/** |
172 |
/** |
Lines 320-326
Link Here
|
320 |
//format mrw-findwhat |
330 |
//format mrw-findwhat |
321 |
if (canonicalString == null |
331 |
if (canonicalString == null |
322 |
|| Character.toUpperCase(canonicalString.charAt(0)) != 'M' |
332 |
|| Character.toUpperCase(canonicalString.charAt(0)) != 'M' |
323 |
|| Character.toUpperCase(canonicalString.charAt(1)) != 'R' |
333 |
|| !MatchType.isCanonicalPatternFlag(canonicalString.charAt(1)) |
324 |
|| Character.toUpperCase(canonicalString.charAt(2)) != 'W' |
334 |
|| Character.toUpperCase(canonicalString.charAt(2)) != 'W' |
325 |
|| canonicalString.charAt(3) != '-') { |
335 |
|| canonicalString.charAt(3) != '-') { |
326 |
return null; |
336 |
return null; |