OTX Reference  
OpenTestSystem.Otx.Extensions.Util.Terms.EscapeToRegularExpression Class Reference

Gets a regular expression which matches the given string More...

Inheritance diagram for OpenTestSystem.Otx.Extensions.Util.Terms.EscapeToRegularExpression:
Inheritance graph

Public Attributes

StringTerm _string
 Cardinality [1]
This is the string to escape. More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.Terms.Term
MetaData metaData
 Cardinality [0..1]
The MetaData type allows tools to store additional, mainly tool-specific data. More...
 

Detailed Description

Gets a regular expression which matches the given string

The EscapeToRegularExpression activity returns a regular expression which matches the given string, but no other strings. This means that for the resulting regular expression, string:MatchToRegularExpression shall return true only for the given string.

Note: For instance, this can be realized by prepending a backslash to all characters which have a special meaning for string:MatchToRegularExpression, such as question marks and brackets.With this, for the given string "a($.)ä\", the result would be "a\‍(\$\.\‍)ä\\".

Syntax
StringTerm = Util.EscapeToRegularExpression(StringTerm string);
Examples
// Local Declarations
String String1;
Boolean Boolean1;
// Flow
// Returns "a\‍(\$\.\‍)ä\\"
String1 = Util.EscapeToRegularExpression("a($.)ä\\");
// Returns true
Boolean1 = StringUtil.MatchToRegularExpression("a($.)ä\\", String1);

Member Data Documentation

◆ _string

StringTerm OpenTestSystem.Otx.Extensions.Util.Terms.EscapeToRegularExpression._string

Cardinality [1]
This is the string to escape.