I think we’re all mixing things a little bit here. Let’s see if I understand what we’re trying to solve.
First, there was this question:
Given a string 12345abc4321, extract abc
This can be done using pub.string:indexOf, a branch step and pub.string:substring. Neither of these services support regular expressions, so don’t try to pass a regular expression. You can only search for one substring at a time at it must be an exact match to get a hit.
Second, there was a follow-up:
Given a string of the form #$$$$#$, where # = a number value, and $ = a letter value, extract the $$$$ portion.
Regular expressions within FLOW will work if you’re only interested in matching the pattern. You specify a branch step, and then for the labels you specify the regular expression you want to match for the leg of the branch to be taken. For example:
branch on /aString
– /.+/: MAP (aString has one or more characters)
– /^SE/: MAP (aString starts with SE)
– /^.{2,3}$/: MAP (aString is any 2 or 3 char string)
– 1: MAP (aString is 1)
– $default: MAP (aString doesn’t match any of the above)
Note that to use a regular expression in a label, you surround the expression with slashes. Do not use the curly braces or the doc.p prefix you show in your example–that syntax is for use within HTML (dsp) pages.
My guess is that using regular expressions within FLOW step labels will not do what you need–they only indicate a pattern match, they don’t extract any parts of the input string.
The quickest way to get what you need is probably to write a Java service that does what you need. Loop over the characters in the string until you hit the first letter, record the index, continue til you hit a number or end of string and record the end index. Then use String.substring() to get the substring and return it in the pipeline.
Hope this helps.