Regular Expression Library


This is a draft proposal for central library of regular expressions to be used by core methods for validation/recognition purposes.
(stub)

lib/regex.inc

/**
 * Wikka Regular Expression Library
 *
 * Defines patterns and regular expressions to be used by core methods for categorizing and validating strings.
 *
 * @package RegEx
 * @version $id$
 */

 
//character sets
define('PATTERN_LCLETTER', 'a-z\xe0-\xf6\xf8-\xff');
define('PATTERN_UCLETTER', 'A-Z\xc0-\xd6\xd8-\xdf');
define('PATTERN_LETTER', PATTERN_LCLETTER.PATTERN_UCLETTER);
define('PATTERN_DIGIT', '0-9');

//stub




Patterns already in use


URI components
/^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/

(source: RFC3986)

Valid WikiName (as of 1.1.6.0)

/^[A-ZÄÖÜ]+[a-zßäöü]+[A-Z0-9ÄÖÜ][A-Za-z0-9ÄÖÜßäöü]*$/s


Proposed RE for valid WikiName
define('PATTERN_LCLETTER', 'a-z\xe0-\xf6\xf8-\xff');
define('PATTERN_UCLETTER', 'A-Z\xc0-\xd6\xd8-\xdf');
define('PATTERN_LETTER', PATTERN_LCLETTER.PATTERN_UCLETTER);
define('PATTERN_DIGIT', '0-9');
$validtag = '/^['.PATTERN_LETTER.']['.PATTERN_LETTER.PATTERN_DIGIT.']+$/';



/^([A-ZÄÖÜ][A-Za-zÄÖÜßäöü]+)[:](\S*)$/



External sites:



CategoryDevelopmentCore CategoryRegex
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki