You want to extract the substrings between Pattern: 1 (Pattern Demo)Code: (Demo)
Output: (100 matches)
If you find that your actual target substrings may contain 3 but this will impact efficiency slightly because greedy patterns outperform lazy patterns.For your sample input, the case-insensitive pattern modifier ( 4) is not necessary. Removing it will improve pattern efficiency by 200steps and maintain the same level of accuracy. If case-insensitivity is necessary for your real data, you should keep the 4 flag; otherwise drop it. |