How to remove lines from a split text using 'Repeat with each item'?

I try to automate some repetitive tasks.

I have a pdf file with an agenda. The shortcut extracts a portion of the text and then tries to clean up the text by removing unnecessary information. Reading the pdf, transferring it to text is no problem in shortcuts.

I made a list specifying ‘text identifiers’ that can be removed from the text.
Therefore I made a list with the ‘text identifiers’. I split the text into lines and then used a toolbox pro ‘Discard times in split text’ to remove the respective lines.

For some reason it does work with one of the list items, the others are neglected.

What should I do differently?

Here is a link to my shortcut. It only contains the concerned parts for my problem.

First of all, it looks like you are processing the original over and over, rather than the revised version, so you could work with a variable to address that, like this:

I also note that some of your source text lines are indented. Note that those lines start with whitespace, and not text characters, so those lines will be left untouched. For example several lines start with spaces followed by “RU” - those lines do not start with RU, so they would not be picked up by your list definitions.

If you wanted to deal with that you should probably look at dropping the discard action and utilising regular expression substitutions instead. You could run these against the original text without needing to split and iterate through line by line.

Hope that helps.

@sylumer Thanks, that put me on the right track. I’ll experiment with the regular expressions.