Regex to Remove Number from String

Regex is not something I’ve ever taken the time to learn. I’m trying to do something that I hope is simple.

I have a string that’s something like this:
2021 Competition Name

What I want is to remove the leading year as well as the space following it, so it looks like this:
Competition Name

At best I can get regex to remove the leading year, but I can’t figure out how to also remove the space, so right now I end up with this:
•Competition Name (The dot is a space)

I can create another column to trim whitespaces, and that works fine, but I was hoping to accomplish the removal of the year as well as the trim with a single regex column.

I was wondering if anybody had any insight on how to accomplish this.

^[/d/s]+ should do it.

Sorry, toothpicks back to front. It should be ^[\d\s]+

Breaking that down:

  • ^ match the start of the string
  • [] consider characters as a group
  • \d any decimal digit
  • \s any white space character
  • + match preceding character/group one or more times

“from the start of the string, match any sequence of digits and/or whitespace characters”


That’s not working for me. Here is a little more context. What I’m trying to do is replace some old vlookup that was combines with some regex logic in my sheet. What’s supposed to happen is that I take a competition name, that includes a year, strip off the year, and then ultimately use that stripped value to create a relation to an Images resource table. The competition is year based, but the image for each particular competition remains the same. This allows a user to create a new competition record, with a name that includes the year, but pulls from the same images resource.

This is what I am using. It extracts everything BUT the year, which is what I want. But it obviously still includes the space between the year and the rest of the string, because it’s not numeric.

Using your regex, it instead returns only the decimal digits and the space, which is the opposite of what I’m looking for.

Hope that makes mores sense. Right now, I can take the regex result from (\D+) and then use the trim plugin, so I’m completely fine with that method, but I wanted to see if I could do it all within the regex extract.

1 Like

You need to get rid of the capturing parentheses, and use a different plugin. Use the Replace All plugin with the regex that I gave you.

Or, to do it with the plugin you’re using now, you could use: ^[\s\d]+(.*)

Example 1: Replace All

Example 2: Extract Matching text


That’s the ticket. I was using the wrong plugin. As you can tell, I haven’t dug really deep into the plugins.
I try to stick to the original glide columns if at all possible. Thanks for the assist!

Your second method works too. I need to sit down sometime and learn regex.

  1. \d\s ↩︎


It’s very rare that I have the opportunity to help you with something. Glad I was around at the right time! :smiley:


Hehe, I try to make a best effort to figure something out myself, but this one had me stumped. Glad you were around too!

1 Like

Sometimes I get into a rabbit hole where something seems so dang simple, and I keep searching and trying things without making any progress. Eventually, I begin to question myself, and begin to wonder if what I’m trying to do is even possible.


haha, yes I can relate to that. In times like that, I find that setting it aside for a while and working on something else almost always helps. Or go for a walk, or sleep on it. Then come back at it with a fresh mind. Inevitably, I find the answer staring me in the face :crazy_face:

As an aside, of those two regex options above, the first would be (ever so) slightly more efficient. That’s because it will stop as soon as it hits the first non-matching character, whereas the second will continue to the end of the string.


In that case, you’ll be needing a copy of the bible. Was pride of place on my bookshelf back in the day :wink:


I’ll have to check out that book. We use a very small amount of regex at work, and at most, only a couple of the other developers deal with that stuff, so I’ve never had to touch it. Now SQL…on the other hand…I’ve done some crazy things with that. :wink:


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.