Skip to main content
Solved

Regex to extract 1, 2 or 3 digit number after character

  • September 30, 2022
  • 2 replies
  • 84 views

Forum|alt.badge.img+6

Hello, I’m trying to extract the final number at the end of a string like this:

Josh-B7-3
Ben-B8-28
Chris-BN-294

I want to extract just:
3
28
294

Any ideas? Appreciate your time :slightly_smiling_face:

Best answer by kuovonne

Try this. It features the $ control character for matching the end of a string that I recently talked about in the BuildOnAir podcast.

REGEX_EXTRACT(
    {field name},
    "\d*$"
)

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • Answer
  • September 30, 2022

Try this. It features the $ control character for matching the end of a string that I recently talked about in the BuildOnAir podcast.

REGEX_EXTRACT(
    {field name},
    "\d*$"
)

Forum|alt.badge.img+6
  • Author
  • Inspiring
  • 11 replies
  • September 30, 2022

Thanks so much @kuovonne