Search code examples
.netregexnintex-workflow

regex - How to get everything after a character


I have this Regex

(?<=\\).*$

I string is domain\username and I like to get the username. This regex code only gives me username without the domain.

What's the code to get forward value after the first backslash "\". The regex should give me username.


Solution

  • In a Nintex workflow, there are several types of actions.

    If you select Extract, the [^\\]+$ should fetch you all chars other than \ at the end of the string (thus, fetching b if a\b is given).

    If you use Replace, the ^.*\\ will match and remove any 0+ chars other than newline (in .NET, a newline) as many as possible up to the last \ and the backslash itself, turning x\b into b.