Leading zeroes in ID

Hey everyone!

I’m working on a project where I need to search for people with given ID. ID’s are in the form of ABC001, ABC002 etc
The requirement is to display the user with ID ABC001 when someone searches with ID ABC1. In a sense, leading zeroes shouldn’t hold any value while searching. I’ve tried using regex and find&replace along with filters to do this, but no success.
Any help would be much appreciated.

Did you try a find and Replace like this (it should work)?

Thanks for your response but that will replace all the zeroes. I also have IDs like ABC010, which should be returned when someone searches ABC10. And in some cases the length of ID might change to something like ABC00001 (5 digit number after text). Only leading zeroes should be ignored in all the cases.


True. Didn’t consider that scenario :man_facepalming:

I’m working on this regex replace but I’m not sure how the capturing groups go in Bubble. I’m going to test it out and I’ll post it when it’s finished.


Edit: I need to modify this to do a positive look-ahead give me a few more minutes to sort that out so it matches the correct part of the string. Right now it’s matching the whole string.

Thanks for your help man

This is the regex you need in the find and replace:


I tested this on a few test cases but if you find something that’s not working it can be sorted.

I really appreciate your help but I guess it’s removing all the zeroes

Sorry for the delay my regex “skillz” are really rusty these days (apparently) Try this instead (no guarantees still):


@maheshkasindi, feel free to ignore me here if I’m just muddying the waters. Oh, and full disclosure… I don’t pretend to know jack about regex, but I like to practice by trying to figure out answers to questions like the one in this thread when they come up.

The above being said, I have something that appears to work by doing two find and replaces on the initial string. The first find and replace uses the following regex to get rid of everything in the string that isn’t a letter.


The second find and replace removes all of the letters and leading zeros after the letters.


So, if you put the output of those find and replaces together, you get the desired result. By the way, I am happy to be ridiculed into oblivion if using two expressions is the worst idea ever… but it works, so I’ve got that going for me, which is nice. :wink:

1 Like

@mikeloc it’s not a terrible idea, I almost resorted to that and then stumbled upon the regex I finally posted (I think that one gets the job done). However, your idea and logic are sound.

@bubble.trouble, thanks for the feedback… much appreciated. Truth be told, the only reason I went down that path is because I couldn’t get the latest one you posted to work, so I wanted to see if I could come up with something. Are you sure that one works?

@bubble.trouble no with regex it all depends on the input and I only tested a few inputs. It’s very possible that a different input would cause it to fail…

This topic was automatically closed after 70 days. New replies are no longer allowed.