Skip to main content
Nintex Community Menu Bar

Substring to Get Certain Number of Letters From The Right

  • March 27, 2019
  • 3 replies
  • 45 views

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
  • March 27, 2019

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+.


cabeza
Forum|alt.badge.img+3
  • Author
  • Novice
  • March 29, 2019

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


Forum|alt.badge.img+9
  • April 8, 2019

To get 4 last characters of a string use:

.*(.{4,4})$