FlexText and Regular Expressions

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Data Sources and Targets > MapForce FlexText >

FlexText and Regular Expressions

In MapForce FlexText, you can use regular expressions as follows:

 

1.To split text containers whenever a match is found (the matched text acts as separator). In this case, regular expressions are implicitly anchored; therefore, the caret ( ^ ) and the dollar sign ( $ ) characters are not used. For example, to match any three consecutive digits, use [0-9]{3} instead of ^[0-9]{3}$.
2.To redirect text from a Switch container if the text contains a regular expression match.

 

You can use regular expressions in FlexText components in any of the following MapForce target languages:

 

Built-in (when previewing the mapping)
Built-in (when running the MapForce Server execution file)
Code generation languages (C++, C#, Java). Note that, in these languages, some advanced features of regular expressions may depend on the regular expressions implementation in that specific language.

 

The regular expression syntax and semantics in FlexText is based on http://www.w3.org/TR/xmlschema-2/#regexs, similar to the MapForce core function tokenize-regexp. Note the following:

 

If the split condition matches two sequences following each other, FlexText creates an empty result in between (this behavior is the same when you are not using regular expressions).
No regular expression flags (http://www.w3.org/TR/xquery-operators/#flags) are supported.

 

This section includes the following topics:

 

Splitting Text with Regular Expressions.
Using Regular Expressions in Switch Conditions

© 2019 Altova GmbH