Pinning here to save others some googling… I know I can’t be the only one looking for how to achieve this.
This simple regex expression will remove the last x no. of characters in a string.
.{x}$ where x= the no. of characters you want to remove, including spaces.
(Bubble’s current truncate options doesn’t work for variable string lengths.) My use case is abbreviating formatted Google addresses, as the WHOLE address is not necessary for what I need and clutters my UX. I wanted everything except, the 5-digit zip and “, USA”
Using a dynamic expression, I did a find & replace on my formatted address and checked “Use regex pattern” box.
So,
Google’s formatted address: 6910 Fayetteville Rd, Durham, NC 27713, USA
Displays as: 6910 Fayetteville Rd, Durham, NC
Of course you can build more sophisticated expressions and add different qualifiers, but I just needed the basics here.
Here are my reference, fyi.
The board where I found the expression: regex - How to remove the last 13 (or n) characters of every line using Notepad++ - Stack Overflow
A tester to check & build expressions:
A cheat/reference sheet
https://regexlib.com/CheatSheet.aspx?AspxAutoDetectCookieSupport=1
Happy building ![]()
