Skip to main content
Nintex Community Menu Bar

Substring to Get Certain Number of Letters From The Right

  • Mar 27, 2019 2:46 PM UTC
  • 3 replies
  • 49 views
  • Translate All

cabeza
Forum|alt.badge.img+3

The fn-Substring(a,b,c) is useful when we start count from the string left side.
What if i want to get the x number of characters from the right side where the strings can have different length?
For example if X=4
The input for:
Abcd-1234
Ab(xyz)1234
Abcdefxyz1234
All need to give the Output as 1234

3 replies

Forum|alt.badge.img+9
  • Mar 27, 2019 3:17 PM UTC

You can use a regular expression. Result will be assigned to a single line text variable:

 

1214iF215E4F1A4C3551E.png

if you want it to be exactly four digits, use d{4,4} instead of d+.

Translate

cabeza
Forum|alt.badge.img+3
  • Author
  • Novice
  • Mar 29, 2019 8:41 AM UTC

Thank you Mlauer for your reply,
But sorry couldnt get it to work, or maybe I missed something.
in my example, when i mentioned 1234, i mean any four alphanumiric characters, it doesnt mean the last for letters are always numbers,
also the input string is not always the same size, it can be any number of alphanumeric string

Translate

Forum|alt.badge.img+9
  • Apr 8, 2019 8:46 AM UTC

To get 4 last characters of a string use:

.*(.{4,4})$

Translate