Use Matches activity and set the Input property to the string that you want to extract the text from. In the Properties pane, set the Pattern property to the regular expression pattern P-\d+ and the Result property to a variable of type MatchCollection.
Then use Add a For Each activity to loop through the matches and set TypeArgument property to System.Text.RegularExpressions.Match.
Inside the For Each activity, you can access the matched text using the Value property of the current item.
I am getting string from DB and storing single string in variable. For eg variable is containing “UNION TOWNSHIP P-21915”
Now from this string i want P-21915
Above string change for next record but i want to extract the same thing mean value starting P and having 5 numeric character.
here we cannot interact as we don’t know what is not working. But with the given link and the mention of debugging and working with the debugging panels you would be able to detect the issue. Also, you can prototype/test the different statements e.g. within the immediate panel