- Introduction to WorkXpress
- Building Your Application
- Examples and Best Practices
- Technical Manual
This shows you the differences between two versions of the page.
expression function - string between [2016/09/14 18:19] |
expression function - string between [2016/09/14 18:19] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== String Between (Expression Function) ====== | ||
+ | |||
+ | ===== Purpose ===== | ||
+ | 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. | ||
+ | |||
+ | {{::string_between_initial.png?direct&600|}} | ||
+ | ===== Parameters ===== | ||
+ | The **String Between** function has three parameters, all of which are required: | ||
+ | |||
+ | ==== Haystack ==== | ||
+ | |||
+ | Allowed Inputs: [[Field|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. | ||
+ | |||
+ | ==== Start ==== | ||
+ | |||
+ | Allowed Inputs: [[Field|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. | ||
+ | |||
+ | ==== End ==== | ||
+ | |||
+ | Allowed Inputs: [[Field|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. | ||
+ | |||
+ | ===== Output ===== | ||
+ | |||
+ | The output of the **String Between** function is the string that starts just after the Start parameter, and ends just before the End parameter. | ||
+ | |||
+ | ===== Example ===== | ||
+ | |||
+ | <code>STRING_BETWEEN('<div>Lot Size: 140 acres</div>','Lot Size:','</div>')</code> 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: <code>STRING_BETWEEN('<div>Lot Size: 140 acres</div>','Lot Size:\s','</div>')</code> will return '140 acres'; | ||
+ | |||
+ | For additional help with regular expressions try [[http://www.regular-expressions.info/|regular-expressions.info]] | ||