Community Halloween is live until October 31st! Complete any 2 quick activities to earn the 2025 Community Halloween badge. Feeling brave? Check out the activities here
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Regex - capture the end of line value

ErikH
7 - Meteor

Hi,

I'm trying to capture the value after the last "-", for example:

 

Lorem - 12345
Lorem -12p-129 - 12345
Lorem - ABCE1
Lorem Ip-24 - 123456

 

In many of the cases, I have several "-", but what I want is to fetch out the value after the last "-" in the line.   This value can be numbers or text character or a combination of both. I've tried to use regex, but in the cases where yoyu have several "-"'s i fail. 

 

Any help? 

 

Thanks

2 REPLIES 2
jdunkerley79
ACE Emeritus
ACE Emeritus
REGEX_Replace([Field1], "^.*-([^-]+)*$","$1")

Should get you close to what you need

 

  • ^.*-

    Matches everything from start until the last - (greedily)

  • ([^-]+)*$

    Matches everything after last - through to the end and places in $1

 

ErikH
7 - Meteor

Awesome, thanks!

Labels
Top Solution Authors