2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.common.util;
23 import com.google.common.base.CharMatcher;
24 import org.apache.commons.collections.CollectionUtils;
25 import org.apache.commons.lang3.StringEscapeUtils;
26 import org.apache.commons.lang3.StringUtils;
27 import org.apache.commons.lang3.math.NumberUtils;
28 import org.apache.commons.lang3.text.WordUtils;
29 import org.apache.commons.validator.routines.UrlValidator;
30 import org.jsoup.Jsoup;
31 import org.jsoup.helper.StringUtil;
32 import org.jsoup.safety.Whitelist;
35 import java.util.regex.Pattern;
37 public class ValidationUtils {
38 public final static Integer COMPONENT_NAME_MAX_LENGTH = 1024;
39 public final static Pattern COMPONENT_NAME_PATTERN = Pattern
40 .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (COMPONENT_NAME_MAX_LENGTH-1) + "}$");
41 public final static Integer ADDITIONAL_INFORMATION_KEY_MAX_LENGTH = 50;
42 public final static Pattern ADDITIONAL_INFORMATION_KEY_PATTERN = Pattern
43 .compile("^[\\w\\s\\.\\-\\_]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
44 public final static Integer RSI_NAME_MAX_LENGTH = 1024;
45 public final static Pattern RSI_NAME_PATTERN = Pattern
46 .compile("^[\\w \\s\\.\\-\\_\\:\\+]{1," + RSI_NAME_MAX_LENGTH + "}$");
47 public final static Integer COMMENT_MAX_LENGTH = 256;
49 public final static Integer ICON_MAX_LENGTH = 25;
50 public final static Pattern ICON_PATTERN = Pattern.compile("^[\\w\\-]{1," + ICON_MAX_LENGTH + "}$");
51 public final static Integer PROJECT_CODE_MAX_LEGTH = 50;
52 public final static Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\s\\w_.-]{5,50}$");
54 // USER_ID format : aannnX (where a=a-z or A-Z, n=0-9, and X=a-z,A-Z, or 0-9)
55 public final static Integer CONNTACT_ID_MAX_LENGTH = 50;
56 // public final static Pattern CONTACT_ID_PATTERN = Pattern
57 // .compile("[mM]{1}[0-9]{5}|[a-zA-Z]{2}[0-9]{4}|[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{1}");
58 public final static Pattern CONTACT_ID_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,50}$");
59 public final static Pattern OCTET_PATTERN = Pattern.compile("%[a-fA-F0-9]{2}");
60 public final static Pattern NONE_UTF8_PATTERN = Pattern.compile("[^\\x00-\\x7F]+");
61 public final static Pattern URL_INVALIDE_PATTERN = Pattern.compile("[,#?&@$<>~^`\\\\\\[\\]{}|\")(*!+=;%]+");// ,#?&@$<>~^`\\[]{}|")(*!
63 public final static Pattern ENGLISH_PATTERN = Pattern.compile("^[\\p{Graph}\\x20]+$");
64 public final static Pattern COMMENT_PATTERN = Pattern.compile("^[\\u0000-\\u00BF]{1,1024}$");
65 public final static Pattern SERVICE_METADATA_PATTERN = Pattern.compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]{1,256}");
66 public final static Integer COMPONENT_DESCRIPTION_MAX_LENGTH = 1024;
67 public final static Integer SERVICE_TYPE_MAX_LENGTH = 256;
68 public final static Integer SERVICE_ROLE_MAX_LENGTH = 256;
69 public final static Integer SERVICE_FUNCTION_MAX_LENGTH = 256;
70 public final static Integer SERVICE_NAMING_POLICY_MAX_SIZE = 100;
72 public final static Integer TAG_MAX_LENGTH = 1024;
73 public final static Integer TAG_LIST_MAX_LENGTH = 1024;
74 public final static Integer VENDOR_NAME_MAX_LENGTH = 60;
75 public final static Pattern VENDOR_NAME_PATTERN = Pattern
76 .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
77 public final static Integer VENDOR_RELEASE_MAX_LENGTH = 25;
78 public final static Pattern VENDOR_RELEASE_PATTERN = Pattern
79 .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
80 public final static Integer RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH = 65;
82 public final static Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/<?>\\*:|\"/]+");
84 public final static Pattern DASH_PATTERN = Pattern.compile("[-]+");
85 public final static Pattern UNDERSCORE_PATTERN = Pattern.compile("[_]+");
86 public final static Pattern PLUS_PATTERN = Pattern.compile("[+]+");
87 public final static Pattern SPACE_PATTERN = Pattern.compile("[ ]+");
88 public final static Pattern AMP_PATTERN = Pattern.compile("[&]+");
89 public final static Pattern DOT_PATTERN = Pattern.compile("[\\.]+");
90 public final static Pattern APOST_PATTERN = Pattern.compile("[']+");
91 public final static Pattern HASHTAG_PATTERN = Pattern.compile("[#]+");
92 public final static Pattern EQUAL_PATTERN = Pattern.compile("[=]+");
93 public final static Pattern COLON_PATTERN = Pattern.compile("[:]+");
94 public final static Pattern AT_PATTERN = Pattern.compile("[@]+");
95 public final static Pattern AND_PATTERN = Pattern.compile(" [aA][Nn][Dd] ");
96 public final static Set<String> CATEGORY_CONJUNCTIONS = new HashSet<>(
97 Arrays.asList("of", "to", "for", "as", "a", "an", "the"));
99 public final static Pattern COST_PATTERN = Pattern.compile("^[0-9]{1,5}\\.[0-9]{1,3}$");
100 public final static Pattern ARTIFACT_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9 \\-+]+$");
101 public final static Integer ARTIFACT_LABEL_LENGTH = 255;
102 public final static Pattern ARTIFACT_DISPLAY_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
103 public final static Pattern CATEGORY_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
104 public final static Integer CATEGORY_LABEL_MIN_LENGTH = 3;
105 public final static Integer CATEGORY_LABEL_MAX_LENGTH = 25;
107 public final static Pattern COMPONENT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_]+");
108 public final static Pattern COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
109 public final static Pattern PRODUCT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_&=#@':\\[\\]\\+]+");
110 public final static Integer CONSUMER_NAME_MAX_LENGTH = 255;
111 // public final static Pattern CONSUMER_NAME_PATTERN =
112 // Pattern.compile("^[\\w]{1}?[\\w\\.\\-]{0," + CONSUMER_NAME_MAX_LENGTH +
114 public final static Pattern CONSUMER_NAME_PATTERN = Pattern.compile("^[\\w]+[\\w\\.\\-]*$");
115 public final static Integer CONSUMER_SALT_LENGTH = 32;
116 public final static Integer CONSUMER_PASSWORD_LENGTH = 64;
117 public final static Pattern CONSUMER_PASS_SALT_PATTERN = Pattern.compile("^[a-z0-9]+$");
118 public final static Pattern FLOAT_PATTERN = Pattern.compile("^[\\d]+[\\.]{1}[\\d]+$");
119 public final static Pattern CERTIFIED_VERSION_PATTERN = Pattern.compile("^[1-9][0-9]*\\.0$");
120 public final static Pattern MINOR_VERSION_PATTERN = Pattern.compile("^0\\.[1-9][0-9]*$");
121 public final static Pattern TAGS_PATTERN = Pattern.compile("<[^><]*>");
122 public final static Pattern TAG_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,1024}$");
124 public final static Integer ARTIFACT_NAME_LENGTH = 255;
125 public final static Integer API_URL_LENGTH = 100;
126 public final static Integer ARTIFACT_DESCRIPTION_MAX_LENGTH = 256;
128 public final static Integer PRODUCT_FULL_NAME_MIN_LENGTH = 4;
129 public final static Integer PRODUCT_FULL_NAME_MAX_LENGTH = 100;
130 public static final Integer FORWARDING_PATH_NAME_MAX_LENGTH = 100;
131 public final static Pattern FORWARDING_PATH_NAME_PATTERN = Pattern.compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (FORWARDING_PATH_NAME_MAX_LENGTH-1) + "}$");
133 public final static Integer POLICY_MAX_LENGTH = 1024;
134 public final static Pattern POLICY_NAME_PATTERN = Pattern
135 .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (POLICY_MAX_LENGTH-1) + "}$");
137 public static boolean validateArtifactLabel(String label) {
138 return ARTIFACT_LABEL_PATTERN.matcher(label).matches();
141 public static boolean validateArtifactDisplayName(String displayName) {
142 return ARTIFACT_DISPLAY_NAME_PATTERN.matcher(displayName).matches();
145 public static String cleanUpText(String text){
146 text = removeNoneUtf8Chars(text);
147 text = normaliseWhitespace(text);
148 text = stripOctets(text);
149 text = removeHtmlTagsOnly(text);
153 public static boolean validateTagPattern(String tag) {
154 return TAG_PATTERN.matcher(tag).matches();
157 public static boolean validateServiceMetadata(String metadataField) {
158 return SERVICE_METADATA_PATTERN.matcher(metadataField).matches();
161 public static boolean validateCommentPattern(String comment) {
162 return COMMENT_PATTERN.matcher(comment).matches();
165 public static boolean validateCategoryDisplayNameFormat(String label) {
168 label = label.trim();
169 res = CATEGORY_LABEL_PATTERN.matcher(label).matches();
174 public static String normalizeCategoryName4Display(String str) {
177 str = DASH_PATTERN.matcher(str).replaceAll("-");
178 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
179 str = AMP_PATTERN.matcher(str).replaceAll("&");
180 str = PLUS_PATTERN.matcher(str).replaceAll("+");
181 str = DOT_PATTERN.matcher(str).replaceAll(".");
182 str = APOST_PATTERN.matcher(str).replaceAll("'");
183 str = HASHTAG_PATTERN.matcher(str).replaceAll("#");
184 str = EQUAL_PATTERN.matcher(str).replaceAll("=");
185 str = COLON_PATTERN.matcher(str).replaceAll(":");
186 str = AT_PATTERN.matcher(str).replaceAll("@");
187 str = normaliseWhitespace(str);
188 str = AND_PATTERN.matcher(str).replaceAll(" & ");
191 StringBuilder sb = new StringBuilder();
192 String[] split = str.split(" ");
193 for (int i = 0; i < split.length; i++) {
194 String splitted = split[i];
195 String lowerCase = splitted.toLowerCase();
196 // BANK OF AMERICA --> BANK of AMERICA ("of" is lowercased), but
197 // OF BANK OF AMERICA --> OF BANK of AMERICA (first "OF" is not
198 // lowercased because it's first word)
199 // Agreed with Ella, 26/11/15
200 if ((i > 0) && CATEGORY_CONJUNCTIONS.contains(lowerCase)) {
201 sb.append(lowerCase);
203 sb.append(WordUtils.capitalize(splitted));
207 str = sb.toString().trim();
212 public static String normalizeCategoryName4Uniqueness(String str) {
213 return str.toLowerCase();
216 public static boolean validateCategoryDisplayNameLength(String label) {
217 return (label != null && label.length() >= CATEGORY_LABEL_MIN_LENGTH
218 && label.length() <= CATEGORY_LABEL_MAX_LENGTH);
221 public static boolean validateProductFullNameLength(String fullName) {
222 return (fullName != null && fullName.length() >= PRODUCT_FULL_NAME_MIN_LENGTH
223 && fullName.length() <= PRODUCT_FULL_NAME_MAX_LENGTH);
226 public static boolean validateArtifactLabelLength(String label) {
227 return label.length() > 0 && label.length() <= ARTIFACT_LABEL_LENGTH;
230 public static boolean validateResourceInstanceNameLength(String resourceInstanceName) {
231 return resourceInstanceName.length() <= RSI_NAME_MAX_LENGTH;
234 public static boolean validateResourceInstanceName(String resourceInstanceName) {
235 return RSI_NAME_PATTERN.matcher(resourceInstanceName).matches();
238 public static boolean validateUrlLength(String url) {
239 return url.length() <= API_URL_LENGTH;
242 public static boolean validateArtifactNameLength(String artifactName) {
243 return (artifactName.length() <= ARTIFACT_NAME_LENGTH && artifactName.length() > 0);
246 public static boolean validateComponentNamePattern(String componentName) {
247 return COMPONENT_NAME_PATTERN.matcher(componentName).matches();
250 public static boolean validateComponentNameLength(String componentName) {
251 return componentName.length() <= COMPONENT_NAME_MAX_LENGTH;
254 public static boolean validateIcon(String icon) {
255 return ICON_PATTERN.matcher(icon).matches();
258 public static boolean validateIconLength(String icon) {
259 return icon.length() <= ICON_MAX_LENGTH;
262 public static boolean validateProjectCode(String projectCode) {
263 return PROJECT_CODE_PATTERN.matcher(projectCode).matches();
266 public static boolean validateProjectCodeLegth(String projectCode) {
267 return projectCode.length() <= PROJECT_CODE_MAX_LEGTH;
270 public static boolean validateContactId(String contactId) {
271 return CONTACT_ID_PATTERN.matcher(contactId).matches();
274 public static boolean validateCost(String cost) {
275 return COST_PATTERN.matcher(cost).matches();
278 public static String removeHtmlTags(String str) {
279 return Jsoup.clean(str, Whitelist.none());
282 public static String removeAllTags(String htmlText) {
284 return TAGS_PATTERN.matcher(htmlText).replaceAll("").trim();
287 public static String normaliseWhitespace(String str) {
288 StringBuilder sb = new StringBuilder(str.length());
289 appendNormalisedWhitespace(sb, str, false);
290 return sb.toString();
293 private static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading) {
294 boolean lastWasWhite = false;
295 boolean reachedNonWhite = false;
297 int len = string.length();
299 for (int i = 0; i < len; i+= Character.charCount(c)) {
300 c = string.codePointAt(i);
301 if (isWhitespace(c)) {
302 if ((stripLeading && !reachedNonWhite) || lastWasWhite)
308 accum.appendCodePoint(c);
309 lastWasWhite = false;
310 reachedNonWhite = true;
315 private static boolean isWhitespace(int c){
319 public static String stripOctets(String str) {
320 return OCTET_PATTERN.matcher(str).replaceAll("");
323 public static String removeNoneUtf8Chars(String input) {
324 return NONE_UTF8_PATTERN.matcher(input).replaceAll("");
327 public static boolean validateIsEnglish(String input) {
328 return ENGLISH_PATTERN.matcher(input).matches();
331 public static boolean validateIsAscii(String input) {
333 return CharMatcher.ASCII.matchesAllOf(input);
336 public static String convertHtmlTagsToEntities(String input) {
337 return StringEscapeUtils.escapeHtml4(input);
340 public static List<String> removeDuplicateFromList(List<String> list) {
341 Set<String> hs = new LinkedHashSet<>(list);
348 public static boolean validateTagLength(String tag) {
350 return tag.length() <= TAG_MAX_LENGTH;
355 public static boolean validateTagListLength(int tagListLength) {
356 return tagListLength <= TAG_LIST_MAX_LENGTH;
359 public static boolean validateDescriptionLength(String description) {
360 return description.length() <= COMPONENT_DESCRIPTION_MAX_LENGTH;
363 public static boolean validateStringNotEmpty(String value) {
364 if ((value == null) || (value.isEmpty())) {
370 public static boolean validateListNotEmpty(List<?> list) {
371 if ((list == null) || (list.isEmpty())) {
377 public static boolean validateVendorName(String vendorName) {
378 return VENDOR_NAME_PATTERN.matcher(vendorName).matches();
381 public static boolean validateVendorNameLength(String vendorName) {
382 return vendorName.length() <= VENDOR_NAME_MAX_LENGTH;
385 public static boolean validateResourceVendorModelNumberLength(String resourceVendorModelNumber) {
386 return resourceVendorModelNumber.length() <= RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH;
389 public static boolean validateVendorRelease(String vendorRelease) {
390 return VENDOR_RELEASE_PATTERN.matcher(vendorRelease).matches();
393 public static boolean validateVendorReleaseLength(String vendorRelease) {
394 return vendorRelease.length() <= VENDOR_RELEASE_MAX_LENGTH;
397 public static boolean validateServiceTypeLength(String serviceType) {
398 return serviceType.length() <= SERVICE_TYPE_MAX_LENGTH;
401 public static boolean validateServiceRoleLength(String serviceRole) {
402 return serviceRole.length() <= SERVICE_ROLE_MAX_LENGTH;
405 public static boolean validateServiceFunctionLength(String serviceFunction) {
406 return serviceFunction.length() <= SERVICE_FUNCTION_MAX_LENGTH;
409 public static boolean validateServiceNamingPolicyLength(String namingPolicy) {
410 return namingPolicy.length() <= SERVICE_NAMING_POLICY_MAX_SIZE;
412 public static boolean hasBeenCertified(String version) {
413 return NumberUtils.toDouble(version) >= 1;
416 public static String normaliseComponentName(String name) {
417 String[] split = splitComponentName(name);
418 StringBuilder sb = new StringBuilder();
419 for (String splitElement : split) {
420 sb.append(splitElement);
422 return sb.toString();
426 public static String normalizeComponentInstanceName(String name) {
427 String[] split = splitComponentInstanceName(name);
428 StringBuilder sb = new StringBuilder();
429 for (String splitElement : split) {
430 sb.append(splitElement);
432 return sb.toString();
436 private static String[] splitComponentName(String name) {
437 String normalizedName = name.toLowerCase();
438 normalizedName = COMPONENT_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
439 return normalizedName.split(" ");
442 private static String[] splitComponentInstanceName(String name) {
443 String normalizedName = name.toLowerCase();
444 normalizedName = COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
445 return normalizedName.split(" ");
448 public static String convertToSystemName(String name) {
449 String[] split = splitComponentName(name);
450 StringBuilder sb = new StringBuilder();
451 for (String splitElement : split) {
452 String capitalize = WordUtils.capitalize(splitElement);
453 sb.append(capitalize);
455 return sb.toString();
458 public static String normalizeFileName(String filename) {
459 // String[] split = filename.split(Pattern.quote(File.separator));
462 // name = split[split.length - 1];
463 return cleanFileName(filename);
467 private static String cleanFileName(String str) {
468 str = CLEAN_FILENAME_PATTERN.matcher(str).replaceAll("");
469 str = normaliseWhitespace(str);
470 str = SPACE_PATTERN.matcher(str).replaceAll("-");
471 str = DASH_PATTERN.matcher(str).replaceAll("-");
472 str = StringUtils.strip(str, "-_ .");
477 public static boolean validateUrl(String url) {
479 UrlValidator urlValidator = new UrlValidator();
480 if (!urlValidator.isValid(url)) {
483 if (NONE_UTF8_PATTERN.matcher(url).find()) {
487 if (URL_INVALIDE_PATTERN.matcher(url).find()) {
494 public static String cleanArtifactDisplayName(String strIn) {
495 String str = DASH_PATTERN.matcher(strIn).replaceAll("-");
496 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
497 str = PLUS_PATTERN.matcher(str).replaceAll("+");
498 str = normaliseWhitespace(str);
500 // str = str.replaceAll(" ", "");
505 public static String normalizeArtifactLabel(String strIn) {
507 String str = DASH_PATTERN.matcher(strIn).replaceAll("");
508 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("");
509 str = PLUS_PATTERN.matcher(str).replaceAll("");
510 str = SPACE_PATTERN.matcher(str).replaceAll("");
511 str = DOT_PATTERN.matcher(str).replaceAll("");
512 str = str.toLowerCase();
517 public static boolean validateAdditionalInformationKeyName(String str) {
518 return ADDITIONAL_INFORMATION_KEY_PATTERN.matcher(str).matches();
521 public static String normalizeAdditionalInformation(String str) {
523 str = DASH_PATTERN.matcher(str).replaceAll("-");
524 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
525 str = normaliseWhitespace(str);
530 public static boolean validateLength(String str, int length) {
534 return str.length() <= length;
537 public static boolean validateConsumerName(String consumerName) {
538 return CONSUMER_NAME_PATTERN.matcher(consumerName).matches();
541 public static boolean isUTF8Str(String str) {
542 if (NONE_UTF8_PATTERN.matcher(str).find()) {
548 public static boolean validateConsumerPassSalt(String consumerSalt) {
549 return CONSUMER_PASS_SALT_PATTERN.matcher(consumerSalt).matches();
552 public static boolean isFloatNumber(String number) {
553 return FLOAT_PATTERN.matcher(number).matches();
556 public static boolean validateCertifiedVersion(String version) {
557 return (version != null && CERTIFIED_VERSION_PATTERN.matcher(version).matches());
560 public static boolean validateMinorVersion(String version) {
561 return (version != null && MINOR_VERSION_PATTERN.matcher(version).matches());
564 public static boolean validateCategoryIconNotEmpty(List<String> categoryIcons) {
565 return CollectionUtils.isEmpty(categoryIcons);
568 public static String normaliseProductName(String name) {
569 String[] split = splitComponentName(PRODUCT_NAME_DELIMETER_PATTERN, name);
570 StringBuilder sb = new StringBuilder();
571 for (String splitElement : split) {
572 sb.append(splitElement);
574 return sb.toString();
578 private static String[] splitComponentName(Pattern pattern, String name) {
579 String normalizedName = name.toLowerCase();
580 normalizedName = pattern.matcher(normalizedName).replaceAll(" ");
581 return normalizedName.split(" ");
584 public static String removeHtmlTagsOnly(String htmlText) {
585 return HtmlCleaner.stripHtml(htmlText, false);
588 public static boolean validateForwardingPathNamePattern(String forwardingPathName) {
589 return FORWARDING_PATH_NAME_PATTERN.matcher(forwardingPathName).matches();