Implemented: New TWiki::Func::getRegularExpression Function to get Predefined Regular Expressions
getRegularExpression( $regexName ) ==> $pattern
| Description: |
Retrieves a TWiki predefined regular expression |
Parameter: $regexName |
Name of the regular expression to retrieve. See notes below |
| Return: |
String or precompiled regular expression matching as described below |
| Since: |
TWiki::Plugins::VERSION 1.020 (9 Feb 2004) |
Notes: TWiki internally precompiles several regular expressions to represent various string entities
in an
I18N-compatible manner. Plugins are encouraged to use these in matching where appropriate.
The following are guaranteed to be present; others may exist, but their use is unsupported and
they may be removed in future TWiki versions. Those which are marked "CC" are for use within
character classes and may not produce the desired results outside of them.
| Name |
Matches |
CC |
| upperAlpha |
Upper case characters |
Y |
| lowerAlpha |
Lower case characters |
Y |
| mixedAlpha |
Alphabetic characters |
Y |
| mixedAlphaNum |
Alphanumeric charactecs |
Y |
| wikiWordRegex |
WikiWords |
N |
Example:
my $upper = TWiki::Func::getRegularExpression("upperAlpha");
my $alpha = TWiki::Func::getRegularExpression("mixedAlpha");
my $capitalized = qr/[$upper][$alpha]+/;
--
RichardDonkin - 09 Feb 2004
Discussions
Added docs of feature added on 09 Feb 2004 by
RichardDonkin.
--
PeterThoeny - 29 Aug 2004