The scan function can be used on a string to return an array of strings based on input patterns.
Explaining the Example
In this example, the input string is. The pattern will be found in between the two / symbol from , which in this case is \d+ .
The \d in the pattern represent any digit, and the + sign after it represents one or more repetitions. This results in retrieving an array of strings which is [01, 23, 2014].
Lastly, the function will join up the three strings, separated by the "-" character, resulting in the final string of 01-23-2014.
More About Patterns
To learn more about what patterns you can use in the scan method, click here for an article on regular expressions and commonly used patterns.
Do remember that the scan function return fields in the form of an array. However, arrays cannot usually be used directly in text fields. You can use additional functions that convert Arrays into Strings to format the results correctly. Some formulas you can use to do this are: join, smart_join, and to_s. See list of common formulas for help using these formulas.