Wiki source for RegexLibrary


Show raw source

===== Regular Expression Library =====

>>**See also**
[[ValidPageNames Pagename validation]]
>> 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##**

%%(php)
/**
* 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: [[http://www.gbiv.com/protocols/uri/rfc/rfc3986.html RFC3986]])

==Valid WikiName ##(as of 1.1.6.0)##==

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

==Proposed RE for valid WikiName ==
%%(php)
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.']+$/';
%%

~& Why not allow tags starting with digits as some users requested? -- DarTar

==Valid InterWiki Link ##(as of 1.1.6.0)##==

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

----
==External sites:==
~-[[http://www.regexlib.com/ Regular Expression Library]]


----
CategoryDevelopmentCore CategoryRegex
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki