community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Regex - capture the end of line value

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

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

 

Meteor

Awesome, thanks!

Labels