Quantcast
Channel: CodeProject Latest postings for Regular Expressions
Viewing all articles
Browse latest Browse all 224

Matching separate regions

$
0
0
Hi,
I'm using Notepad++ to do some Regex replacements and have come up against a problem I can't solve.
I'm looking to match a region between two fixed strings inclusive (called <startstring> and <endstring> for the sake of example). The problem I have is these strings appear multiple times throughout, but I want to match EACH instance, rather than one match from the very first <startstring> to the last <endstring>. They may or may not be over many lines. For example:

<startstring>

...text body...

<endstring>

...other text...

<startstring>

...text body...

<endstring>

...other text...

<startstring>

...text body...

<endstring>

I need my Regex to make 3 separate matches, rather than 1 big match which includes all the ..other text... which I need to be left intact.

The above needs to work irrespective of whether the <startstring> and <endstring> are on the same line or many lines apart.

Thanks in advance.

Viewing all articles
Browse latest Browse all 224

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>