jps1006
11
If you didn’t have the ‘use a regex pattern’ box checked, bubble would have looked for the exact sequence of characters ‘\d(?=\d\d$)’ in your text and not found it. When evaluating as a regex, those characters take on meaning:
d by itself would have looked for every letter ‘d’ and replaced it with ‘9’.
\d when you add the ‘\’ it says to look for every digit (0-9)
(?=) for everything that matches what comes after the ‘=’, don’t include it in the result, but look ahead (in front) of ‘(?=)’ to find what you want included in the result. In this case \d(?=\d\d) you are looking for the number that comes in front of 2 numbers. If we had left it at that, it would have found every place 3 numbers were in a row and given you the first number of each of those matches (and repaced it with ‘9’) When you add the ‘$’ it says that the ‘$’ represents the end of the text, so only one set of 3 numbers in a row is at the very end.
It’s always best to test these expressions to confirm how they are read.
A couple other things to note:
If you were looking to extract a number from a number type, I assume you would need to convert the number to a text (:format as…) evaluate, and then convert it back to a number (I don’t think bubble does this automatically, but haven’t checked).
If you are using ‘:extract with Regex’ (outside of ‘find & replace’) it will return a list, and even if there is only one result, you may need to select ‘:first item’
1 Like