Skip to main content
Nintex Community Menu Bar
Solved

Regex action to substitute for Substring


Forum|alt.badge.img+5

I need to parse a string in a workflow.  Basically, I need to get a substring out of it by position, just like Substring function does.  Since I cannot use functions in the workflow, I am trying to use the Regular Expression action instead.  Still, I have been struggling to get the correct pattern.  Can someone recommend a regex pattern that would substitute a substring function?  Say to get a part of string from 5th to the 10th position.

Thank you.

Best answer by Nintex_Andrea

I was able to get this expression to work in my test workflow: (?<=^.{4}).{5} Where 4 represents the starting position and 5 represents the number of characters you want to extract. Keep in mind that the character index starts at 0 not 1.


 



 

View original
Translate
Did this topic help you find an answer to your question?

3 replies

Nintex_Andrea
Nintex Employee
Forum|alt.badge.img+5
  • Nintex Employee
  • 24 replies
  • Answer
  • June 8, 2021

I was able to get this expression to work in my test workflow: (?<=^.{4}).{5} Where 4 represents the starting position and 5 represents the number of characters you want to extract. Keep in mind that the character index starts at 0 not 1.


 



 

Translate

Forum|alt.badge.img+5
  • Author
  • Rookie
  • 28 replies
  • June 8, 2021
Hi @Nintex_Andrea,

This is incredible. I spent so much time trying to get the correct pattern, and still was not getting anywhere. It is strange that Nintex is not taking literal integers in the expression, but only variables. I would have not guessed it if not for your screenshot.
Thank you so much for the help.
Translate

Nintex_Andrea
Nintex Employee
Forum|alt.badge.img+5
I was able to get it to work with both literal integers and variables. I ended up creating a component workflow to call from other workflows... like a function. So I ended up using the start variables in the expression. But it should work either way.
Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings