001// --------------------------------------------------------------------------------
002// Copyright 2002-2024 Echo Three, LLC
003//
004// Licensed under the Apache License, Version 2.0 (the "License");
005// you may not use this file except in compliance with the License.
006// You may obtain a copy of the License at
007//
008//     http://www.apache.org/licenses/LICENSE-2.0
009//
010// Unless required by applicable law or agreed to in writing, software
011// distributed under the License is distributed on an "AS IS" BASIS,
012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013// See the License for the specific language governing permissions and
014// limitations under the License.
015// --------------------------------------------------------------------------------
016
017package com.echothree.util.server.validation;
018
019import java.util.regex.Pattern;
020
021public interface Patterns {
022    
023    Pattern Option = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|_)+$");
024    Pattern TableNameSingular = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|_)+$");
025    
026    Pattern Id = Pattern.compile("^[0-9]+$");
027    Pattern Boolean = Pattern.compile("^(true|false)$");
028    Pattern EntityName = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|_)+$");
029    Pattern EntityName2 = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|_)+:([a-z]|[A-Z]|[0-9]|-|_)+$");
030    Pattern EntityNames = Pattern.compile("^(|([a-z]|[A-Z]|[0-9]|-|_)+:)*([a-z]|[A-Z]|[0-9]|-|_)+$");
031    Pattern EntityRef = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|_|\\.)+\\.([a-z]|[A-Z]|[0-9]|-|_|\\.)+\\.([0-9])+$");
032    Pattern EmailAddress = Pattern.compile("^.+@.+\\.(com|net|int|org|mil|edu|gov|[a-z][a-z]|aero|biz|coop|info|museum|name|pro)$");
033    Pattern Year = Pattern.compile("^(19|20)[0-9][0-9]$");
034    Pattern SignedNumbers = Pattern.compile("^((|-)[0-9]+|MAX_VALUE|MIN_VALUE)$");
035    Pattern UnsignedNumbers = Pattern.compile("^([0-9]+|MAX_VALUE)$");
036    Pattern PhoneNumber = Pattern.compile("^(\\(|)[0-9][0-9][0-9]((\\)( |)|)|([-\\.]|))[0-9][0-9][0-9]([ -\\.]|)[0-9][0-9][0-9][0-9]$");
037    Pattern Inet4Address = Pattern.compile("^([0-9]|[0-9][0-9]|[0-9][0-9][0-9])\\.([0-9]|[0-9][0-9]|[0-9][0-9][0-9])\\.([0-9]|[0-9][0-9]|[0-9][0-9][0-9])\\.([0-9]|[0-9][0-9]|[0-9][0-9][0-9])$");
038    Pattern InternationalPhoneNumber = Pattern.compile("^[0-9\\-\\.\\ \\(\\)]+$");
039    Pattern InternationalPhoneCountry = Pattern.compile("^[0-9][0-9]([0-9]|)$");
040    Pattern State = Pattern.compile("^[a-zA-Z][a-zA-Z]$");
041    Pattern YOrN = Pattern.compile("^[yYnN]$");
042    Pattern TrueOrFalse = Pattern.compile("^([tT][rR][uU][eE]|[fF][aA][lL][sS][eE])$");
043    Pattern Precent = Pattern.compile("^(|1)(|[0-9])[0-9](|%)$");
044    Pattern FractionalPercent = Pattern.compile("^(|1)(|[0-9])[0-9](|\\.(|[0-9])(|[0-9])(|[0-9]))(|%)$");
045    Pattern HostName = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|\\.)+$");
046    Pattern DomainName = Pattern.compile("^([0-9a-z\\-])+\\.(com|net|int|org|mil|edu|gov|[a-z][a-z]|aero|biz|coop|info|museum|name|pro)$");
047    Pattern DomainSuffix = Pattern.compile("^\\.(com|net|int|org|mil|edu|gov|[a-z][a-z]|aero|biz|coop|info|museum|name|pro)$");
048    Pattern CreditCardMonth = Pattern.compile("^((|0)[1-9]|1[0-2])$");
049    Pattern CreditCardYear = Pattern.compile("^(20[0-9][0-9]|([0-9][0-9]|[0-9]))$");
050    Pattern UpperLetter2 = Pattern.compile("^[A-Z][A-Z]$");
051    Pattern UpperLetter3 = Pattern.compile("^[A-Z][A-Z][A-Z]$");
052    Pattern Number3 = Pattern.compile("^[0-9][0-9][0-9]$");
053    Pattern Numbers = Pattern.compile("^[0-9]+$");
054    Pattern SequenceMask = Pattern.compile("^[AZ9]+$");
055    Pattern Tag = Pattern.compile("^([a-z]|[0-9]|-|_| )+$");
056    Pattern TimeZoneName = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|_|\\.|/)+$");
057    Pattern MimeType = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|_|\\.\\+)+/([a-z]|[A-Z]|[0-9]|-|_|\\.|\\+)+$");
058    Pattern Key = Pattern.compile("^([a-z]|[A-Z]|[0-9]|-|_)+$");
059    Pattern HarmonizedTariffScheduleCode = Pattern.compile("^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$");
060    
061}