Constructor
new module:caplin/element/parser/RegExpParser()
Transforms a string against a standard JavaScript regular expression.
RegExpParser
is typically used in the XML Renderer Framework, but can be invoked programmatically
as in the following examples which evaluate to null (match failed), 'simple' and 'sample' respectively:
caplin.element.parser.RegExpParser.parse('simple', {match:'z'})
caplin.element.parser.RegExpParser.parse('simple', {match:'i'})
caplin.element.parser.RegExpParser.parse('simple', {match:'i', replace:"a"})
- Implements:
Methods
-
parse(value, mAttributes) → {String}
-
Transforms a string against a standard JavaScript regular expression.
If the string matches, then the function replaces the matched part with the replace expression, otherwise the function return null.
Parameters:
Name Type Description value
String the string to parse. mAttributes
Map a list of attributes, as specified in module:caplin/element/formatter/RegExpFormatter
.Returns:
replacement string upon match, otherwise null.- Type
- String