Singleton
caplin.element.parser

RegExpParser

Implements caplin.element.Parser.
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"})

Constructor Summary

Attributes Name and Description
caplin.element.parser.RegExpParser()

Method Summary

Attributes Name and Description
String parse(Variant vValue, Map mAttributes)

Transforms a string against a standard JavaScript regular expression.

Constructor Detail

caplin.element.parser.RegExpParser()

Method Detail

String parse(Variant vValue, Map mAttributes)

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
Variant vValue the string to parse.
Map mAttributes a list of attributes, as specified in caplin.element.formatter.RegExpFormatter.
Returns
replacement string upon match, otherwise null.