- Introduction to WorkXpress
- Building Your Application
- Examples and Best Practices
- Technical Manual
The String Between function (STRING_BETWEEN) is used to extract of substring from a larger string that is found between the start and end strings. These start and end strings to search for can contain regular expressions.
The String Between function has three parameters, all of which are required:
Allowed Inputs: field value or text string
The first parameter of the String Between function is the string to extract from. Use the Query Builder to choose a field that contains the value.
Allowed Inputs: field value or text string
The second parameter is the string to search for to start the extraction. It can either be obtained from a field using the Query Builder or from a literal string. This part of the haystack is not returned.
Allowed Inputs: field value or text string
The third parameter is the string to search for to end the extraction. It can either be obtained from a field using the Query Builder or from a literal string. This part of the haystack is not returned.
The output of the String Between function is the string that starts just after the Start parameter, and ends just before the End parameter.
STRING_BETWEEN('<div>Lot Size: 140 acres</div>','Lot Size:','</div>')
will return ' 140 acres'.
To eliminate the extra white space before the 140 we can add a regular expression character match that will match for whitespace. Therefore:
STRING_BETWEEN('<div>Lot Size: 140 acres</div>','Lot Size:\s','</div>')
will return '140 acres';
For additional help with regular expressions try regular-expressions.info