I have a formula in my transform pipeline that contains an instance of the ReplaceRegex() function. It's written like this...
ReplaceRegex(Transaction Description,"^.*(BD\d{3,4}).*$","$1")
If I understand the formula correctly, this should find the substring "BD" followed by three or four digits within a longer string, and then return only the BD and the three or four digits. This should work regardless of how many characters there are before or after the substring. However, if the Transaction Description column is " ABD MOHD SHAHRIR MACBOOK PRO 15"-SPACE GRAY P" then the function returns the whole string. If the Transaction Description column contains a valid BD number, then it returns only the BD substring (this is the desired behaviour).
Perhaps I'm understanding the function incorrectly. If the substring (defined by the regex) isn't found, shouldn't the function return an empty string?