Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Alpha represents regular expression for alpha characters Alpha string = "^[a-zA-Z]+$" // AlphaDash represents regular expression for alpha characters with underscore and dash AlphaDash string = "^[a-zA-Z0-9_-]+$" // AlphaSpace represents regular expression for alpha characters with underscore, space and dash AlphaSpace string = "^[-a-zA-Z0-9_ ]+$" // AlphaNumeric represents regular expression for alpha numeric characters AlphaNumeric string = "^[a-zA-Z0-9]+$" // CreditCard represents regular expression for credit cards like (Visa, MasterCard, American Express, Diners Club, Discover, and JCB cards). Ref: https://stackoverflow.com/questions/9315647/regex-credit-card-number-tests CreditCard string = "" /* 154-byte string literal not displayed */ // Coordinate represents latitude and longitude regular expression Coordinate string = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?),\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$" // Ref: https://stackoverflow.com/questions/3518504/regular-expression-for-matching-latitude-longitude-coordinates // CSSColor represents css valid color code with hex, rgb, rgba, hsl, hsla etc. Ref: http://www.regexpal.com/97509 CSSColor string = "^(#([\\da-f]{3}){1,2}|(rgb|hsl)a\\((\\d{1,3}%?,\\s?){3}(1|0?\\.\\d+)\\)|(rgb|hsl)\\(\\d{1,3}%?(,\\s?\\d{1,3}%?){2}\\))$" // Date represents regular expression for valid date like: yyyy-mm-dd Date string = "" /* 231-byte string literal not displayed */ // DateDDMMYY represents regular expression for valid date of format dd/mm/yyyy , dd-mm-yyyy etc.Ref: http://regexr.com/346hf DateDDMMYY string = "^(0?[1-9]|[12][0-9]|3[01])[\\/\\-](0?[1-9]|1[012])[\\/\\-]\\d{4}$" // Digits represents regular expression for validating digits Digits string = "^[+-]?([0-9]*\\.?[0-9]+|[0-9]+\\.?[0-9]*)([eE][+-]?[0-9]+)?$" // Email represents regular expression for email Email string = "" /* 133-byte string literal not displayed */ // Float represents regular expression for finding float number Float string = "^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$" // IP represents regular expression for ip address IP string = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$" // IPV4 represents regular expression for ip address version 4 IPV4 string = "^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$" // IPV6 represents regular expression for ip address version 6 IPV6 string = `` /* 1057-byte string literal not displayed */ // Latitude represents latitude regular expression Latitude string = "^(\\+|-)?(?:90(?:(?:\\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\\.[0-9]{1,6})?))$" // Longitude represents longitude regular expression Longitude string = "^(\\+|-)?(?:180(?:(?:\\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\\.[0-9]{1,6})?))$" // MacAddress represents regular expression for mac address MacAddress string = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$" // Numeric represents regular expression for numeric Numeric string = "^-?[0-9]+$" // URL represents regular expression for url URL string = "^(?:http(s)?:\\/\\/)?[\\w.-]+(?:\\.[\\w\\.-]+)+[\\w\\-\\._~:/?#[\\]@!\\$&'\\(\\)\\*\\+,;=.]+$" // Ref: https://stackoverflow.com/questions/136505/searching-for-uuids-in-text-with-regex // UUID represents regular expression for UUID UUID string = "^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$" // UUID3 represents regular expression for UUID version 3 UUID3 string = "^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$" // UUID4 represents regular expression for UUID version 4 UUID4 string = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" // UUID5 represents regular expression for UUID version 5 UUID5 string = "^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" ISBN10 string = "^(?:[0-9]{9}X|[0-9]{10})$" ISBN13 string = "^(?:[0-9]{13})$" Alphanumeric string = "^[a-zA-Z0-9]+$" Int string = "^(?:[-+]?(?:0|[1-9][0-9]*))$" Hexadecimal string = "^[0-9a-fA-F]+$" Hexcolor string = "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$" RGBcolor string = "" /* 157-byte string literal not displayed */ ASCII string = "^[\x00-\x7F]+$" Multibyte string = "[^\x00-\x7F]" FullWidth string = "[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]" HalfWidth string = "[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]" Base64 string = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$" PrintableASCII string = "^[\x20-\x7E]+$" DataURI string = "^data:.+\\/(.+);base64$" MagnetURI string = "^magnet:\\?xt=urn:[a-zA-Z0-9]+:[a-zA-Z0-9]{32,40}&dn=.+&tr=.+$" DNSName string = `^([a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*[\._]?$` URLSchema string = `((ftp|tcp|udp|wss?|https?):\/\/)` URLUsername string = `(\S+(:\S*)?@)` URLPath string = `((\/|\?|#)[^\s]*)` URLPort string = `(:(\d{1,5}))` URLIP string = `([1-9]\d?|1\d\d|2[01]\d|22[0-3]|24\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-5]))` URLSubdomain string = `((www\.)|([a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])*[a-zA-Z0-9]\.[a-zA-Z0-9]+))` SSN string = `^\d{3}[- ]?\d{2}[- ]?\d{4}$` WinPath string = `^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$` UnixPath string = `^(/[^/\x00]*)+/?$` Semver string = "" /* 183-byte string literal not displayed */ HasLowerCase string = ".*[[:lower:]]" HasUpperCase string = ".*[[:upper:]]" HasWhitespace string = ".*[[:space:]]" HasWhitespaceOnly string = "^[[:space:]]+$" IMEI string = "^[0-9a-f]{14}$|^\\d{15}$|^\\d{18}$" IMSI string = "^\\d{14,15}$" )
Taken from https://bit.ly/2X3EFcS
View Source
const ( RegExForEachWordsWithDollarSymbol = "\\$(\\w+)(\\d*)" // Selects a full word that starts with a "$" symbol EachWordsWithinPercentSymbol = "\\%(\\w+)(\\d*)%" // Selects a full word that is within two "%" symbol NginxBlockStart = "\\{\\s*(\\#(\\s)*.*)" NginxBlockEnding = "\\}\\s*(\\#(\\s)*.*)" NginxEmptyBlockOnlyBraces = "\\{\\}" NginxEmptyBlockWithSpaces = "\\{\\s*\\}" NginxEmptyBlockWithCommentAndSpacesOnly = "\\{\\s*\\#+\\s*[aA0-zZ9]*\\s*\\n*\\}" IpFormat = "(\\d{1,3}\\.{1}){3}\\d{1,3}" // 255.255.255.255 IpWithSubnetPrefixFormat = "(\\d{1,3}\\.{1}){3}\\d{1,3}\\/\\d{1,2}" // 255.255.255.255/0 IpWithPortFormat = "(\\d{1,3}\\.{1}){3}\\d{1,3}\\:\\d{1,6}" // 127.0.0.1:8080 NginxEmptyBlock = "(\\{\\}|\\{\\s*\\}|\\{\\s*\\#+\\s*[aA0-zZ9]*.*[aA0-zZ9]*\\.*\\s*\\n*\\})" // Reference : https://regexr.com/5jgh0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.