Contentserv PHP API

CSRegexUtils
in package

Collection of various convenience methods regarding regular expressions.

Tags
since

CS15.0

Table of Contents

getRegexForClassAndMethod()  : string
Returns the string with the regex for validating class and method names.
getRegexForCmykColor()  : string
Returns the string with the regex for matching a CMYK color in the form "cmyk(C,M,Y,K)".
getRegexForCSVersion()  : string
Returns the regular expression to split the CS Version with major, minor version and revision.
getRegexForDateAndDateTime()  : string
Returns a regex for UTC timeformat like: "2017-12-24" and "2017-12-24 20:15" and "2017-12-24 20:15.999999"
getRegexForEANCode()  : string
Returns the regular expression for an EAN code (EAN-8 | EAN-13).
getRegexForEMail()  : string
Returns the string with the regex for an e-mail address
getRegexForEMailMulti()  : string
Returns a string with the regex for multiple e-mail addresses.
getRegexForFileName()  : string
Returns the string with the regex for a file name Following characters are not allowed: ? * / \ | < > : " A single 0 is not allowed Additionally to this no whitespace or dot char is allowed at the beginning of the filename.
getRegexForFolderName()  : string
Returns the string with the regex for a folder name
getRegexForGeoCoordinate()  : string
Returns the string with the regex for a geo coordinate.
getRegexForHexColor()  : string
Returns the string with the regex for matching a hex color in the form "#FFF" or "#FFFFFF" or with transparency as "#FFFFFF00".
getRegexForHtml()  : string
Returns the string with the regex for matching valid HTML tags.
getRegexForHtmlDimensions()  : string
Returns the string with the regex for the Height and Width dimensions Following by 'px' or '%'
getRegexForHtmlTags()  : string
Returns the string with the regex for matching any html tags Can be used for example when strip_tags returns a wrong result
getRegexForIllegalJavascriptChar()  : string
Returns the string with the regex for an illegal JavaScript character.
getRegexForIllegalSubfolderName()  : string
Returns the string with the regex for an illegal subfolder name
getRegexForIllegalXml10Char()  : string
Returns the string with the regex for an illegal XML-v1.0 character.
getRegexForIncompatiblePhpAndJsTokens()  : string
Returns the string with the regex for matching the incompatible tokens.
getRegexForIPAddress()  : string
Returns a pattern to validate a string as a valid IP address
getRegexForJapaneseCharacters()  : string
Returns a regular expression to identify japanese characters.
getRegexForNonAscii()  : string
Returns the string with the regex to detect non ascii characters
getRegexForQuotedStrings()  : string
Returns the string with the regex for matching quoted strings.
getRegexForRgbColor()  : string
Returns the string with the regex for matching an rgb color in the form "rgb(r,g,b)".
getRegexForURL()  : string
Returns the string with the regex for a valid url

Methods

getRegexForClassAndMethod()

Returns the string with the regex for validating class and method names.

public static getRegexForClassAndMethod() : string

Only letters, numbers and underscore are allowed. Because of File name and Class name (PHP) restrictions.

Tags
access

public

Return values
string

getRegexForCmykColor()

Returns the string with the regex for matching a CMYK color in the form "cmyk(C,M,Y,K)".

public static getRegexForCmykColor() : string
Tags
Return values
string

getRegexForCSVersion()

Returns the regular expression to split the CS Version with major, minor version and revision.

public static getRegexForCSVersion() : string
Tags
Return values
string

getRegexForDateAndDateTime()

Returns a regex for UTC timeformat like: "2017-12-24" and "2017-12-24 20:15" and "2017-12-24 20:15.999999"

public static getRegexForDateAndDateTime() : string
Tags
access

public

Return values
string

getRegexForEANCode()

Returns the regular expression for an EAN code (EAN-8 | EAN-13).

public static getRegexForEANCode() : string
Tags
Return values
string

getRegexForEMail()

Returns the string with the regex for an e-mail address

public static getRegexForEMail() : string

Index: 1: complete email 2: name 3: domainname 4: TLD

Tags
access

public

Return values
string

getRegexForEMailMulti()

Returns a string with the regex for multiple e-mail addresses.

public static getRegexForEMailMulti([string $sAllowedSeparators = ',' ]) : string

If the range of allowed address separators is extended to fit GUI needs, you should remember to perform proper replacements against the comma before using the combined address with any sendmail engine.

Parameters
$sAllowedSeparators : string = ','

A string containing all characters that should be valid e-mail address delimiters. The comma is used by default (as accepted by most MTAs).

Tags
access

public

Return values
string

getRegexForFileName()

Returns the string with the regex for a file name Following characters are not allowed: ? * / \ | < > : " A single 0 is not allowed Additionally to this no whitespace or dot char is allowed at the beginning of the filename.

public static getRegexForFileName([string $sExtension = '' ]) : string
Parameters
$sExtension : string = ''

A string containing a file extension to force extension check

Tags
access

public

Return values
string

getRegexForFolderName()

Returns the string with the regex for a folder name

public static getRegexForFolderName() : string
Tags
access

public

Return values
string

getRegexForGeoCoordinate()

Returns the string with the regex for a geo coordinate.

public static getRegexForGeoCoordinate() : string
Tags
access

public

Return values
string

getRegexForHexColor()

Returns the string with the regex for matching a hex color in the form "#FFF" or "#FFFFFF" or with transparency as "#FFFFFF00".

public static getRegexForHexColor() : string
Tags
Return values
string

getRegexForHtml()

Returns the string with the regex for matching valid HTML tags.

public static getRegexForHtml() : string
Tags
Return values
string

getRegexForHtmlDimensions()

Returns the string with the regex for the Height and Width dimensions Following by 'px' or '%'

public static getRegexForHtmlDimensions() : string
Tags
access

public

Return values
string

getRegexForHtmlTags()

Returns the string with the regex for matching any html tags Can be used for example when strip_tags returns a wrong result

public static getRegexForHtmlTags() : string
Tags
access

public

Return values
string

getRegexForIllegalJavascriptChar()

Returns the string with the regex for an illegal JavaScript character.

public static getRegexForIllegalJavascriptChar() : string

This regular expressions contains the surrounding slashes as well as a modifier and thus may be incompatible with JavaScript RegExes.

Tags
access

public

Return values
string

getRegexForIllegalSubfolderName()

Returns the string with the regex for an illegal subfolder name

public static getRegexForIllegalSubfolderName() : string
Tags
access

public

Return values
string

getRegexForIllegalXml10Char()

Returns the string with the regex for an illegal XML-v1.0 character.

public static getRegexForIllegalXml10Char() : string

This regular expressions contains the surrounding slashes as well as a modifier and thus may be incompatible with JavaScript RegExes.

Tags
access

public

Return values
string

getRegexForIncompatiblePhpAndJsTokens()

Returns the string with the regex for matching the incompatible tokens.

public static getRegexForIncompatiblePhpAndJsTokens() : string

Negative Lookahead that only match if the regular expression doesn't have any of the incompatible PHP and Javascript Regex tokens. e.g.: \u and \x{

Tags
Return values
string

getRegexForIPAddress()

Returns a pattern to validate a string as a valid IP address

public static getRegexForIPAddress() : string
Tags
access

public

Return values
string

getRegexForJapaneseCharacters()

Returns a regular expression to identify japanese characters.

public static getRegexForJapaneseCharacters() : string
Tags
Return values
string

getRegexForNonAscii()

Returns the string with the regex to detect non ascii characters

public static getRegexForNonAscii() : string
Tags
access

public

Return values
string

getRegexForQuotedStrings()

Returns the string with the regex for matching quoted strings.

public static getRegexForQuotedStrings() : string
Tags
access

public

Return values
string

getRegexForRgbColor()

Returns the string with the regex for matching an rgb color in the form "rgb(r,g,b)".

public static getRegexForRgbColor() : string
Tags
Return values
string

getRegexForURL()

Returns the string with the regex for a valid url

public static getRegexForURL([bool $bOnlyUrlAllowed = FALSE ][, bool $bUseMultiline = FALSE ]) : string
Parameters
$bOnlyUrlAllowed : bool = FALSE

If set to TRUE only a valid URL is allowed in the inputfield

$bUseMultiline : bool = FALSE

If set to TRUE the regex works for a multi inputfield

Tags
access

public

Return values
string

The PCRE pattern matching the desired URL type.


        

Search results