RegExpFormatter
is typically used in the XML Renderer Framework, but can be invoked programmatically
as in the following examples which evaluate to "8987551787.0" and "Buy USD" respectively:
caplin.element.formatter.RegExpFormatter.format("8987551787.0", { match:"[A-Z]" })
caplin.element.formatter.RegExpFormatter.format("Buy.USD", { match:"(\\.", replace:" " })
Attributes | Name and Description |
---|---|
|
caplin.element.formatter.RegExpFormatter()
|
Attributes | Name and Description |
---|---|
|
String
format(Variant vValue, Map mAttributes)
Transforms a string using a standard JavaScript regular expression. |
►
caplin.element.formatter.RegExpFormatter()
►
String
format(Variant vValue, Map mAttributes)
Transforms a string using a standard JavaScript regular expression. By default, only the first match is substituted with the replacement string (unless the "g" option is supplied) and the match is case sensitive (unless the "i" option is supplied).
Attribute Options:
Option | Description |
---|---|
match | string to match (a standard JavaScript RegExp). |
replace | string to use as replacement (optional, defaults to the empty string). |
flags | regular expression flags (optional, standard JavaScript RegExp flags). |
Variant | vValue | the string. |
Map | mAttributes | the map of attributes. |