Morning, your question should really be under "general problem solving". Also there's an edit button to make changes to your original post.
Anyway, your unexpected results are most likely due to the fact that you are applying the regex from a task after the list files task and are thus operating on the STDOUT of the previous task which is the entire list at once, as opposed to creating a loop and operating on the output of the files a line at a time. Depending on what you are ultimately trying to do will call for one of these methods and an appropriate regex tailored to that method as the source strings will be different and you need to allow for that.
i.e. When operating on the previous task's STDOUT of the entire list, output is really one large string with embedded \r\n's in it that you have to allow for in the regex.
Do you really want to operate on a line at a time, or do you want the output to be a list of strings from the last part of filename in the path that follow the last underscore in the filename, start with an 'R', then 6 digits and end before the string '.pdf' at the end of the line?
Note I described what you want to return in painful detail as before you can come up with a regex you should be able to describe what you expect to be returned in plain language. That way you can analyze for mistakes like "whoa, the number of digits could be 1 or more, not strictly 6", or "start with an 'R' but any number of any characters, not just digits". See what I mean?
Please provide some more info. 🙂
Edited by user
2021-10-21T14:45:51Z
|
Reason: Not specified