I thought it might be helpful to have a topic where we could collect regular expressions that we have found useful. I just needed a formula to remove a number from the end of some text, so I came up with this:
If sometext is
abc12, the result will be
If *sometext is
a89bcd12, the result will be
So only numbers at the end of the text will be removed. Numbers in the middle will not be removed.
Here’s how this works:
means match one or more characters that are numeric digits (from 0 to 9).
means that the match must be at the end of the text.
Since the regexreplace( function is being used, the matching text will be replaced, in this case with nothing.