What do you mean it does not work because it is not in a bracket?
The condition item.contains(“The end”) is also not in a bracket right? It should still match the string. May I know where you placed the break activity? It should be at the start, before you use the regex.
Since you are filtering the items using the Bracket and keeping the filtered items inside the for each. "The End will not come into the For each Loop.
So First you pass all the line items into the for each, there you can give if condition "Item,Contains(“The end”), so it will break the loop. In else condition you can do filters based on the bracket.
If the item contains “The end”, in the then condition it will break.
If it does not contains “The end”, in the else condition it will use Matches activity to match bracket in Words Document, and put the Matches result in ForEach loop and get the number.
This is the outcome
When the line does not contains “The end”, it did go to the then condition.
However, it will stay in the then condition until it get all numbers.
After getting all numbers, it will go through the next line in the if condition.
Eg.
The start
Next line
(2 marks)
(4 marks)
(1)
(9)
(3 marks)
The end
The first line “The start” is not the word we want, so it go to the else condition.
In the else condition, it will get all numbers (2, 4 and 3).
The next line is “Next line”, and it will get all numbers again.
Sorry if my explanation is confusing
Why does it keep repeating getting all the numbers ?
Is there anywhere i did wrongly ?
I’d suggest uploading a sample XAML to demo what you are trying and it may make it easier to understand.
Based on the previous responses and your initial post, I can see it in one of two ways
1.
Split the content by line
Loop over line by line
Check if line contains "The End"
If yes, break/continue/or whatever else you want to do
If No, Use your regex and do what you want, and continue
2. Alt
Alter your regex to have an OR (([^)]+)|The End|Next line|The start)
loop over your matches
Add condition if regex subgroup = "The End", break/continue/or whatever else you want to do